Class NaturalComparator<T>
java.lang.Object
org.magicwerk.brownies.collections.helper.NaturalComparator<T>
- Type Parameters:
T- element type
- All Implemented Interfaces:
Serializable, Comparator<T>
The NaturalComparator will compare object using their natural order.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintbooleanstatic <T> Comparator<T> getComparator(Class<T> clazz) Return the natural comparator for the class if it implements Comparable, otherwise null is returned.inthashCode()static <T> NaturalComparator<T> INSTANCE()Returns singleton instance.static <T> NaturalComparator<T> Returns singleton instance.Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Method Details
-
getComparator
Return the natural comparator for the class if it implements Comparable, otherwise null is returned.- Parameters:
clazz- class to get comparator for- Returns:
- comparator for class, null if not available
-
INSTANCE
Returns singleton instance. -
INSTANCE
Returns singleton instance. -
compare
-
equals
- Specified by:
equalsin interfaceComparator<T>- Overrides:
equalsin classObject
-
hashCode
-