String[] sArray = new String[]{"z","a",C"};
List list = Array.aslist(sArray);
Collection.sort(list);//结果为C a z
Collection.sort(list,String.CASE_INSENSITIVE_ORDER);//结果为a C z
Collection.sort(list,Collections.reverseOrder());//z,a,C
Collection.sort(list,String.CASE_INSENSITIVE_ORDER);
Collection.reverse(list);//z,C,a
public static void sort(List list,
Comparator c)Sorts the specified list according to the order induced by the specified comparator. All elements in the list must be mutually comparable using the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the list).
This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n log(n) performance. The specified list must be modifiable, but need not be resizable. This implementation dumps the specified list into an array, sorts the array, and iterates over the list resetting each element from the corresponding position in the array. This avoids the n2 log(n) performance that would result from attempting to sort a linked list in place.