

UnsupportedOperationException - if the specified list's Mutually comparable using the specified comparator. Throws: ClassCastException - if the list contains elements that are not Null value indicates that the elements' natural c - the comparator to determine the order of the list. Type Parameters: T - the class of the objects in the list Parameters: list - the list to be sorted. Method using the specified list and comparator. All elements in the list must be mutuallyĬomparable using the specified comparator (that is,Ĭ.compare(e1, e2) must not throw a ClassCastException Sorts the specified list according to the order induced by the

sort public static void sort( List list,.IllegalArgumentException - (optional) if the implementationĭetects that the natural ordering of the list elements isįound to violate the Comparable contract See Also: List.sort(Comparator) List-iterator does not support the set operation. Mutually comparable (for example, strings and integers). Method using the specified list and a null comparator. Implementation Note: This implementation defers to the List.sort(Comparator) The specified list must be modifiable, but need not be resizable. Not be reordered as a result of the sort. This sort is guaranteed to be stable: equal elements will Must not throw a ClassCastException for any elements Mutually comparable (that is, e1.compareTo(e2) Furthermore, all elements in the list must be Sorts the specified list into ascending order, according to theĪll elements in the list must implement the Comparable ForĮxample, invoking the sort method on an unmodifiable list that isĪlready sorted may or may not throw UnsupportedOperationException. These algorithms may, but are not required to, throw thisĮxception if an invocation would have no effect on the collection. Support the appropriate mutation primitive(s), such as the set To throw UnsupportedOperationException if the collection does not The "destructive" algorithms contained in this class, that is, theĪlgorithms that modify the collection on which they operate, are specified (For example, the algorithm used by sort does not have to beĪ mergesort, but it does have to be stable.) Substitute other algorithms, so long as the specification itself is adhered Suchĭescriptions should be regarded as implementation notes, rather than Generally includes a brief description of the implementation. The documentation for the polymorphic algorithms contained in this class If the collections or class objects provided to them are null. The methods of this class all throw a NullPointerException Specified collection, and a few other odds and ends. It contains polymorphic algorithms that operate onĬollections, "wrappers", which return a new collection backed by a This class consists exclusively of static methods that operate on or returnĬollections.
