This Comparator is useful, for example, for enforcing the natural order in custom implementations of {@link java.util.SortedSet SortedSet} and {@link java.util.SortedMap SortedMap}.
Note: In the 2.0 and 2.1 releases of Commons Collections, this class would throw a {@link ClassCastException} if either of the arguments to{@link #compare(Object,Object) compare} were null
, not{@link Comparable Comparable}, or for which {@link Comparable#compareTo(Object) compareTo} gave inconsistent results.This is no longer the case. See {@link #compare(Object,Object) compare} fordetails.
@since 2.0
@version $Id: ComparableComparator.java 1479403 2013-05-05 21:54:13Z tn $
@see java.util.Collections#reverseOrder()
|
|