Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Iterator; public class Main { public static <E> ArrayList<E> newArrayList(Iterable<E> iterable) { if (iterable == null) { throw new NullPointerException(); } ArrayList<E> list = new ArrayList<E>(); for (Iterator<E> i = iterable.iterator(); i.hasNext();) { list.add(i.next()); } return list; } }