public final class ComparatorUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends Comparable<T>> |
nullSafeCompare(T t1,
T t2)
Does null-safe comparison of mutually comparable objects.
|
static <T> boolean |
nullSafeEquals(T t1,
T t2)
Null-safe equals check. |
public static <T extends Comparable<T>> int nullSafeCompare(T t1, T t2)
Does null-safe comparison of mutually comparable objects.
Obeys common rules of Comparable.compareTo(Object) methods if both objects to compare are non-null.
If one of the objects is null, but the other is not, then null object is considered to be less
than non-null.
Two null objects are considered as equal.
T - the type of objects that this object may be compared tot1 - the first objectt2 - the second objectpublic static <T> boolean nullSafeEquals(T t1,
T t2)
Null-safe equals check. Return true if both arguments are null or equal.
T - the type of objects to compare.t1 - t2 - Copyright © 2014 JBoss by Red Hat. All Rights Reserved.