public final class Lists
extends java.lang.Object
List
interface.Modifier and Type | Method and Description |
---|---|
static <E> void |
sort(java.util.List<E> list,
java.util.Comparator<? super E> c)
Sorts this list using the supplied
Comparator to compare elements. |
public static <E> void sort(java.util.List<E> list, java.util.Comparator<? super E> c)
Comparator
to compare elements.
Implementation Requirements:
The default implementation is equivalent to, for this list
:
Collections.sort(list, c)
E
- the type of the elements of the list to be sortedlist
- the list that should be sortedc
- the Comparator
used to compare list elements.
A null
value indicates that the elements'
natural ordering should be usedjava.lang.ClassCastException
- if the list contains elements that are not
mutually comparable using the specified comparatorjava.lang.UnsupportedOperationException
- if the list's list-iterator does
not support the set
operationjava.lang.IllegalArgumentException
- (optional)
if the comparator is found to violate the Comparator
contract