Here you can find the source of getSorted(Collection
Parameter | Description |
---|---|
collection | a parameter |
public static <T extends Comparable<T>> List<T> getSorted(Collection<T> collection)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { /**/*from w ww . ja va 2 s . co m*/ * Return a sorted list with the collection's elements. * * @param collection * @return */ public static <T extends Comparable<T>> List<T> getSorted(Collection<T> collection) { List<T> ret = new ArrayList<T>(collection.size()); ret.addAll(collection); Collections.sort(ret); return ret; } }