org.pf.text
Class ReverseComparator
java.lang.Object
org.pf.text.ReverseComparator
- All Implemented Interfaces:
- java.util.Comparator
public class ReverseComparator
- extends java.lang.Object
- implements java.util.Comparator
Provides a comparator implementation that is a wrapper around another
comparator with the purpose to reverse the compare order of the given objects.
That allows to easily reverse the sort order of any object collection for
which a comparator is available.
- Version:
- 1.0
- Author:
- M.Duchrow
|
Constructor Summary |
ReverseComparator(java.util.Comparator aComparator)
Initialize the new instance with another comparator |
|
Method Summary |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares its two arguments for order. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
equals |
ReverseComparator
public ReverseComparator(java.util.Comparator aComparator)
- Initialize the new instance with another comparator
compare
public int compare(java.lang.Object o1,
java.lang.Object o2)
- Compares its two arguments for order. Returns a negative integer, zero,
or a positive integer as the first argument is greater than, equal to,
or less than the second.
- Specified by:
compare in interface java.util.Comparator