Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collection; public class Main { public static <K> ArrayList<K> toArrayList(Collection<K> col) { if (col == null) { return new ArrayList<K>(); } ArrayList<K> result = new ArrayList<K>(); for (K k : col) { result.add(k); } return result; } }