Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { /** * Returns collection as sorted ArrayList * * @param collection * @return sorted list */ public static <T extends Comparable<? super T>> List<T> asSortedList(Collection<T> collection) { List<T> list = new ArrayList<T>(collection); Collections.sort(list); return list; } }