Modifier and Type | Method and Description |
---|---|
static <E> void |
sort(List<E> list,
Comparator<? super E> c)
Sorts this list using the supplied
Comparator to compare elements. |
public static <E> void sort(List<E> list, 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 usedClassCastException
- if the list contains elements that are not
mutually comparable using the specified comparatorUnsupportedOperationException
- if the list's list-iterator does
not support the set
operationIllegalArgumentException
- (optional)
if the comparator is found to violate the Comparator
contractCopyright © 2015. All rights reserved.