java.lang.Object | +--org.apache.commons.collections.comparators.ComparableComparatorAll Implemented Interfaces:
java.util.Collections.reverseOrder
int | compare(Object o1, Object o2) Compare the two Comparable Comparable arguments. |
boolean | equals(Object that) Returns true iff that Object is is a Comparator Comparator whose ordering is known to be equivalent to mine. |
static ComparableComparator | Return a shared instance of a ComparableComparator. |
int | hashCode() Implement a hash code for this comparator that is consistent with #equals. |
public ComparableComparator()
public int compare(Object o1, Object o2)
((Comparable Comparable)o1).Comparable.compareTo compareTo(o2)
- when o1 is null,
or when ((Comparable)o1).compareTo(o2) does
- when o1 is not a Comparable Comparable,
or when ((Comparable)o1).compareTo(o2) doespublic boolean equals(Object that)
true
iff that Object is
is a Comparator Comparator whose ordering is
known to be equivalent to mine.
This implementation returns true
iff that.
Object.getClass getClass()
equals this.getClass()
. Subclasses may want to override
this behavior to remain consistent with the Comparator.equals
contract.
public static ComparableComparator getInstance()
public int hashCode()
null
, not Comparable Comparable, or for which Comparable.compareTo compareTo gave inconsistent results. This is no longer the case. See compare for details.