|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.collections.comparators.ReverseComparator
Reverses the order of another comparator by
reversing the arguments to its compare
method.
Collections.reverseOrder()
,
Serialized FormConstructor Summary | |
ReverseComparator()
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. |
Method Summary | |
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(java.lang.Object) . |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReverseComparator()
Collections.reverseOrder()
public ReverseComparator(Comparator comparator)
null
,
the ReverseComparator defaults to reversing the
natural order, as per
Collections.reverseOrder()
.
comparator
- Comparator to reverseMethod Detail |
public int compare(Object o1, Object o2)
compare
in interface Comparator
public int hashCode()
equals(java.lang.Object)
.
hashCode
in class Object
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.
equals getClass()
this.getClass()
, and the underlying
comparators are equal. Subclasses may want to override
this behavior to remain consistent with the
Comparator.equals(java.lang.Object)
contract.
equals
in interface Comparator
equals
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |