Here you can find the source of toArrayListFromIterator(Iterator
public static <T> ArrayList<T> toArrayListFromIterator(Iterator<T> iterator)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Iterator; public class Main { public static <T> ArrayList<T> toArrayListFromIterator(Iterator<T> iterator) { ArrayList<T> r = new ArrayList<T>(); while (iterator.hasNext()) r.add(iterator.next());//from www .jav a 2 s .co m return r; } }