net.sf.molae.pipe.sorted
Class SelfComparator<T extends Comparable<T>>
java.lang.Object
net.sf.molae.pipe.sorted.SelfComparator<T>
- All Implemented Interfaces:
- Comparator<T>
public final class SelfComparator<T extends Comparable<T>>
- extends Object
- implements Comparator<T>
Compares two objects using their natural ordering.
- Since:
- 2.0
Method Summary |
int |
compare(T o1,
T o2)
Forwards the comparison request to the first argument. |
static
|
getInstance()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static <T extends Comparable<T>> Comparator<T> getInstance()
compare
public int compare(T o1,
T o2)
- Forwards the comparison request to the first argument.
- Specified by:
compare
in interface Comparator<T extends Comparable<T>>
- Throws:
NullPointerException
- if either argument is null
.
ClassCastException
- if o1
and o2
cannot be compared to one another using natural ordering.