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.
@author Matt Hall, John Watkinson, Henri Yandell
@version $Revision: 1.1 $ $Date: 2005/10/11 17:05:20 $
@see java.util.Collections#reverseOrder()
@since Commons Collections 2.0