T
- element typepublic class NaturalComparator<T>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
int |
compare(T o1,
T o2) |
boolean |
equals(java.lang.Object that) |
static <T> java.util.Comparator<T> |
getComparator(java.lang.Class<T> clazz)
Return the natural comparator for the class if it implements
Comparable, otherwise null is returned.
|
int |
hashCode() |
static <T> NaturalComparator<T> |
INSTANCE()
Returns singleton instance.
|
static <T> NaturalComparator<T> |
INSTANCE(java.lang.Class<T> c)
Returns singleton instance.
|
public static <T> java.util.Comparator<T> getComparator(java.lang.Class<T> clazz)
clazz
- class to get comparator forpublic static <T> NaturalComparator<T> INSTANCE()
public static <T> NaturalComparator<T> INSTANCE(java.lang.Class<T> c)
public boolean equals(java.lang.Object that)
equals
in interface java.util.Comparator<T>
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object