Java tutorial
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static <T extends Comparable<? super T>> List<T> toSortedList(Collection<T> collection) { List<T> list = new LinkedList<>(collection); Collections.sort(list); return list; } }