|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.util.InvertedComparator<T>
public class InvertedComparator<T>
Compares objects, inverting the order of a wrapped comparator. This means that numeric objects will be sorted in decreasing order etc.
Constructor Summary | |
---|---|
InvertedComparator(Comparator<T> wrappedComp)
Creates a new instance, inverting the order returned by the provided comparator. |
Method Summary | |
---|---|
int |
compare(T o1,
T o2)
Compares its two arguments for order. |
Comparator |
getWrappedComparator()
Returns the comparator wrapped and inverted by this instance. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public InvertedComparator(Comparator<T> wrappedComp)
wrappedComp
- the comparator to wrap and invert; must not be
null
Method Detail |
---|
public int compare(T o1, T o2)
wrapped comparator
, if any. So this method returns a negative integer,
zero, or a positive integer as the first argument is greater than,
equal to, or less than the second.
compare
in interface Comparator<T>
o1
- the first object to be comparedo2
- the second object to be compared
public Comparator getWrappedComparator()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |