Android examples for java.util:Iterator
add Iterator to Collection
import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Queue; import org.apache.log4j.*; public class Main{ public static void main(String[] argv){ Collection c = java.util.Arrays.asList("asdf","book2s.com"); Iterator it = java.util.Arrays.asList("asdf","book2s.com").iterator(); addAll(c,it);/*from w w w. java2 s .c om*/ } public static void addAll(Collection c, Iterator it) { while (it.hasNext()) { c.add(it.next()); } } }