Here you can find the source of iterableToCollection(Iterable extends E> iter, Collection
private static <E> void iterableToCollection(Iterable<? extends E> iter, Collection<E> list)
//package com.java2s; import java.util.Collection; public class Main { private static <E> void iterableToCollection(Iterable<? extends E> iter, Collection<E> list) { if (iter == null) { return; }//from ww w . j a va 2s .c o m for (E element : iter) { list.add(element); } } }