Sort shared collections
This class defines two sorting functions, shown below:
public static <T extends Comparable<? super T>> void sort(List<T> list); public static <T> void sort(List<T> list, Comparator<? super T> c);
None of them are easy on the eyes, and both include a wildcard (?) Operator in their definitions. The first version only accepts a list if T extends Comparable directly or a generic Comparable instance that accepts T or a superclass as a generic parameter. The second version accepts a list and a comparator created using T or a supertype.
source share