SORTING
Alternative sorting of Collections
‣
Collections class contains:
‣
static <T> void sort(List<T> list, Comparator<? super T>
c)
‣
Collections.sort(list, someComparator);
‣
Collections.sort(list, new
ExternalComparatorClass()); or:
‣
Collections.sort(list, T.InnerAnonymousClass);
‣
If list’s elements do not implement!Comparable or cannot be
compared with Comparator,!throw ClassCastException.
11