public final class ObjectUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
nullSafeClassEquals(Object object1,
Object object2)
Compares the classes of the given Objects and returns true if they are identical.
|
static <T> int |
nullSafeCompareTo(Comparable<T> object1,
T object2) |
static boolean |
nullSafeEquals(Object object1,
Object object2)
Performs an equals() check on two Objects, either (or both) of which may be null.
|
static int |
nullSafeHashCode(Object toHash) |
public static boolean nullSafeClassEquals(Object object1, Object object2)
equals
implementation.public static int nullSafeHashCode(Object toHash)
public static boolean nullSafeEquals(Object object1, Object object2)
This method returns true
if both Objects are null. Whether, strictly speaking,
null == null is debatable, but this approach is useful for comparing two parent Objects who
have both left certain properties as null. Generally we want those two parent Objects to be
considered equal.
public static <T> int nullSafeCompareTo(Comparable<T> object1, T object2)
Copyright © 2015. All Rights Reserved.