Here you can find the source of createCollection( final Iterable
public static <T> Collection<T> createCollection( final Iterable<T> object)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; public class Main { public static <T> Collection<T> createCollection( final Iterable<T> object) { final Collection<T> collection = new ArrayList<T>(); for (final T item : object) { collection.add(item);/* ww w.ja v a2 s.c om*/ } return collection; } public static <T> Collection<T> createCollection( final Iterator<T> iterator) { final Collection<T> collection = new ArrayList<T>(); while (iterator.hasNext()) { collection.add(iterator.next()); } return collection; } }