Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; public class Main { public static <T> List<T> ToList2(Collection<T> values) { List<T> alllist = new ArrayList<T>(); Iterator<T> iterator = values.iterator(); T obj = null; while (iterator.hasNext()) { obj = iterator.next(); alllist.add(obj); } return alllist; } }