/** * Returns a hash code for {@code value}; equal to the result of invoking {@code ((Float) * value).hashCode()}. * * <p><b>Java 8 users:</b> use {@link Float#hashCode(float)} instead. * * @param value a primitive {@code float} value * @return a hash code for the value */ public static int hashCode(float value) { // TODO(kevinb): is there a better way, that's still gwt-safe? return ((Float) value).hashCode(); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; }
/** * Returns a hash code for {@code value}; equal to the result of invoking {@code ((Float) * value).hashCode()}. * * <p><b>Java 8 users:</b> use {@link Float#hashCode(float)} instead. * * @param value a primitive {@code float} value * @return a hash code for the value */ public static int hashCode(float value) { // TODO(kevinb): is there a better way, that's still gwt-safe? return ((Float) value).hashCode(); }
/** * Return the same value as {@link Float#hashCode(float)}}. * @deprecated as of Spring Framework 5.0, in favor of the native JDK 8 variant */ @Deprecated public static int hashCode(float flt) { return Float.hashCode(flt); }
/** * 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; }
/** * Returns a hash code for {@code value}; equal to the result of invoking {@code ((Float) * value).hashCode()}. * * <p><b>Java 8 users:</b> use {@link Float#hashCode(float)} instead. * * @param value a primitive {@code float} value * @return a hash code for the value */ public static int hashCode(float value) { // TODO(kevinb): is there a better way, that's still gwt-safe? return ((Float) value).hashCode(); }
/** * Return the same value as {@link Float#hashCode(float)}}. * @deprecated as of Spring Framework 5.0, in favor of the native JDK 8 variant */ @Deprecated public static int hashCode(float flt) { return Float.hashCode(flt); }
@Override public int hashCode() { return i.hashCode(); }
@Override public int getUnsortedEncodedKeyComponentHashCode(@Nullable Float key) { return DimensionHandlerUtils.nullToZero(key).hashCode(); }
public void testHashCode() { for (float value : VALUES) { assertEquals(((Float) value).hashCode(), Floats.hashCode(value)); } }
@Test @Deprecated public void hashCodeWithFloat() { float flt = 34.8f; int expected = (new Float(flt)).hashCode(); assertEquals(expected, ObjectUtils.hashCode(flt)); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode()); hashCode = prime * hashCode + ((getConfidence() == null) ? 0 : getConfidence().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getConfidence() == null) ? 0 : getConfidence().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode()); hashCode = prime * hashCode + ((getConfidence() == null) ? 0 : getConfidence().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCodec() == null) ? 0 : getCodec().hashCode()); hashCode = prime * hashCode + ((getDurationMillis() == null) ? 0 : getDurationMillis().hashCode()); hashCode = prime * hashCode + ((getFormat() == null) ? 0 : getFormat().hashCode()); hashCode = prime * hashCode + ((getFrameRate() == null) ? 0 : getFrameRate().hashCode()); hashCode = prime * hashCode + ((getFrameHeight() == null) ? 0 : getFrameHeight().hashCode()); hashCode = prime * hashCode + ((getFrameWidth() == null) ? 0 : getFrameWidth().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getCollectionId() == null) ? 0 : getCollectionId().hashCode()); hashCode = prime * hashCode + ((getImage() == null) ? 0 : getImage().hashCode()); hashCode = prime * hashCode + ((getMaxFaces() == null) ? 0 : getMaxFaces().hashCode()); hashCode = prime * hashCode + ((getFaceMatchThreshold() == null) ? 0 : getFaceMatchThreshold().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getSimilarity() == null) ? 0 : getSimilarity().hashCode()); hashCode = prime * hashCode + ((getFace() == null) ? 0 : getFace().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getVideo() == null) ? 0 : getVideo().hashCode()); hashCode = prime * hashCode + ((getMinConfidence() == null) ? 0 : getMinConfidence().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); hashCode = prime * hashCode + ((getNotificationChannel() == null) ? 0 : getNotificationChannel().hashCode()); hashCode = prime * hashCode + ((getJobTag() == null) ? 0 : getJobTag().hashCode()); return hashCode; }
@Test public void testHashCode() { final MutableFloat mutNumA = new MutableFloat(0f); final MutableFloat mutNumB = new MutableFloat(0f); final MutableFloat mutNumC = new MutableFloat(1f); assertTrue(mutNumA.hashCode() == mutNumA.hashCode()); assertTrue(mutNumA.hashCode() == mutNumB.hashCode()); assertFalse(mutNumA.hashCode() == mutNumC.hashCode()); assertTrue(mutNumA.hashCode() == Float.valueOf(0f).hashCode()); }