Java tutorial
//package com.java2s; import java.util.*; public class Main { public static <E extends Comparable<E>> List<E> sort(Collection<E> c) { List<E> list = new ArrayList<E>(c); Collections.sort(list); return list; } public static <E> List<E> sort(Collection<E> c, Comparator<E> r) { List<E> list = new ArrayList<E>(c); Collections.sort(list, r); return list; } }