|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jaggregate.Comparing
public class Comparing
Utility class that offers common comparators.
Method Summary | ||
---|---|---|
static
|
byNaturalOrdering()
Answers a comparator that compares its two Comparable arguments
according to their natural ordering; that is, by how they answer
compareTo . |
|
static
|
nullSafe(Comparator<T> comparator)
Answers a comparator that defends against null actual arguments to its
wrapped comparator's compare method. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> Comparator<T> nullSafe(Comparator<T> comparator)
null
actual arguments to its
wrapped comparator's compare
method.
A null
value compares "less than" a non-null
value.
T
- the type of elements to be comparedcomparator
- the comparator to wrap
NullPointerException
- if comparator
is null
public static <T extends Comparable<? super T>> Comparator<T> byNaturalOrdering()
Comparable
arguments
according to their natural ordering; that is, by how they answer
compareTo
. The comparator is
"null safe".
T
- the type of elements to be compared
nullSafe(Comparator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |