java.lang.Object | +--org.apache.commons.collections.comparators.ReverseComparatorAll Implemented Interfaces:
java.util.Collections.reverseOrder
Creates a comparator that compares objects based on the inverse of their natural ordering. |
ReverseComparator(Comparator comparator) Creates a comparator that inverts the comparison of the given comparator. |
int | compare(Object o1, Object o2) |
boolean | equals(Object that) Returns true iff that Object is is a Comparator whose ordering is known to be equivalent to mine. |
int | hashCode() Implement a hash code for this comparator that is consistent with #equals. |
public ReverseComparator()
java.util.Collections.reverseOrder
public ReverseComparator(Comparator comparator)
null
,
the ReverseComparator defaults to reversing the
natural order, as per
java.util.Collections.reverseOrder.
public int compare(Object o1, Object o2)
public boolean equals(Object that)
true
iff that Object is
is a Comparator whose ordering is known to be
equivalent to mine.
This implementation returns true
iff that.
Object.getClass getClass()
equals this.getClass()
, and the underlying
comparators are equal. Subclasses may want to override
this behavior to remain consistent with the
Comparator.equals contract.
public int hashCode()