@Test @Deprecated public void hashCodeWithDouble() { double dbl = 9830.43; int expected = (new Double(dbl)).hashCode(); assertEquals(expected, ObjectUtils.hashCode(dbl)); }
@Test @Deprecated public void hashCodeWithLong() { long lng = 883L; int expected = (new Long(lng)).hashCode(); assertEquals(expected, ObjectUtils.hashCode(lng)); }
@Test @Deprecated public void hashCodeWithBooleanTrue() { int expected = Boolean.TRUE.hashCode(); assertEquals(expected, ObjectUtils.hashCode(true)); }
@Test @Deprecated public void hashCodeWithFloat() { float flt = 34.8f; int expected = (new Float(flt)).hashCode(); assertEquals(expected, ObjectUtils.hashCode(flt)); }
@Test @Deprecated public void hashCodeWithBooleanFalse() { int expected = Boolean.FALSE.hashCode(); assertEquals(expected, ObjectUtils.hashCode(false)); }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(double[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(boolean[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(float[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(long[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return the same value as <code>{@link Double#hashCode()}</code>. * @see Double#hashCode() */ public static int hashCode(double dbl) { long bits = Double.doubleToLongBits(dbl); return hashCode(bits); }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(double[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(float[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(long[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(boolean[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(boolean[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(float[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return a hash code based on the contents of the specified array. * If <code>array</code> is <code>null</code>, this method returns 0. */ public static int nullSafeHashCode(long[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; int arraySize = array.length; for (int i = 0; i < arraySize; i++) { hash = MULTIPLIER * hash + hashCode(array[i]); } return hash; }
/** * Return the same value as <code>{@link Double#hashCode()}</code>. * @see Double#hashCode() */ public static int hashCode(double dbl) { long bits = Double.doubleToLongBits(dbl); return hashCode(bits); }
/** * Return the same value as <code>{@link Double#hashCode()}</code>. * @see Double#hashCode() */ public static int hashCode(double dbl) { long bits = Double.doubleToLongBits(dbl); return hashCode(bits); }
/** * Return a hash code based on the contents of the specified array. * If {@code array} is {@code null}, this method returns 0. */ public static int nullSafeHashCode(@Nullable float[] array) { if (array == null) { return 0; } int hash = INITIAL_HASH; for (float element : array) { hash = MULTIPLIER * hash + Float.hashCode(element); } return hash; }