Here you can find the source of newArrayList(final Iterator
private static <T> List<T> newArrayList(final Iterator<T> iter)
//package com.java2s; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public class Main { private static <T> List<T> newArrayList(final Iterator<T> iter) { if (!iter.hasNext()) { return Collections.emptyList(); }/*ww w .j av a 2 s . c o m*/ final List<T> result = new ArrayList<T>(); while (iter.hasNext()) { result.add(iter.next()); } return result; } }