A {@link Comparator Comparator} that compares {@link Comparable Comparable} objects.
This Comparator is useful, for example, for enforcing the natural order in custom implementations of SortedSet and SortedMap.
Note: In the 2.0 and 2.1 releases of Commons Collections, this class would throw a {@link ClassCastException} ifeither of the arguments to {@link #compare(Object,Object) compare}were
null
, not {@link Comparable Comparable}, or for which {@link Comparable#compareTo(Object) compareTo} gaveinconsistent results. This is no longer the case. See {@link #compare(Object,Object) compare} for details.
@since Commons Collections 2.0
@version $Revision: 1.15 $ $Date: 2004/05/15 13:24:11 $
@author Henri Yandell
@see java.util.Collections#reverseOrder()