public class ObjectUtil extends Object
| Constructor and Description |
|---|
ObjectUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
hashCode(boolean bool)
Return the same value as
Boolean.hashCode()}. |
static int |
hashCode(double dbl)
Return the same value as
Double.hashCode()}. |
static int |
hashCode(float flt)
Return the same value as
Float.hashCode()}. |
static int |
hashCode(long lng)
Return the same value as
Long.hashCode()}. |
static boolean |
isEmpty(Object[] array) |
static boolean |
isNotNull(Object obj) |
static boolean |
isNull(Object obj) |
static boolean |
nullSafeEquals(Object o1,
Object o2)
Determine if the given objects are equal, returning
true if
both are null or false if only one is null. |
static int |
nullSafeHashCode(boolean[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(byte[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(char[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(double[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(float[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(int[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(long[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(Object obj)
Return as hash code for the given object; typically the value of
Object#hashCode()}. |
static int |
nullSafeHashCode(Object[] array)
Return a hash code based on the contents of the specified array.
|
static int |
nullSafeHashCode(short[] array)
Return a hash code based on the contents of the specified array.
|
public static boolean isNull(Object obj)
public static boolean isEmpty(Object[] array)
public static boolean isNotNull(Object obj)
public static int nullSafeHashCode(Object obj)
Object#hashCode()}. If the object is an array,
this method will delegate to any of the nullSafeHashCode
methods for arrays in this class. If the object is null,
this method returns 0.obj - xxxObject.hashCode(),
nullSafeHashCode(Object[]),
nullSafeHashCode(boolean[]),
nullSafeHashCode(byte[]),
nullSafeHashCode(char[]),
nullSafeHashCode(double[]),
nullSafeHashCode(float[]),
nullSafeHashCode(int[]),
nullSafeHashCode(long[]),
nullSafeHashCode(short[])public static int nullSafeHashCode(Object[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(boolean[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(byte[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(char[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(double[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(float[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(int[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(long[] array)
array is null, this method returns 0.array - xxxpublic static int nullSafeHashCode(short[] array)
array is null, this method returns 0.array - xxxpublic static int hashCode(boolean bool)
Boolean.hashCode()}.bool - xxxBoolean.hashCode()public static int hashCode(double dbl)
Double.hashCode()}.dbl - xxxDouble.hashCode()public static int hashCode(float flt)
Float.hashCode()}.flt - xxxFloat.hashCode()public static int hashCode(long lng)
Long.hashCode()}.lng - xxxLong.hashCode()public static boolean nullSafeEquals(Object o1, Object o2)
true if
both are null or false if only one is null.
Compares arrays with Arrays.equals, performing an equality
check based on the array elements rather than the array reference.
o1 - first Object to compareo2 - second Object to compareObject.equals(Object),
Arrays.equals(long[], long[])Copyright © 2018. All rights reserved.