Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.List; import java.util.ArrayList; public class Main { public static <T> List<T> shallowCopyToList(Collection<T> collection) { ArrayList<T> copied = new ArrayList<T>(collection.size()); for (T element : collection) { copied.add(element); } return copied; } }