本文整理了Java中java.lang.Float.hashCode()
方法的一些代码示例,展示了Float.hashCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Float.hashCode()
方法的具体详情如下:
包路径:java.lang.Float
类名称:Float
方法名:hashCode
[英]Returns a hash code for this Float object. The result is the integer bit representation, exactly as produced by the method #floatToIntBits(float), of the primitive float value represented by this Floatobject.
[中]返回此浮点对象的哈希代码。结果是该Floatobject表示的基本浮点值的整数位表示,与#floatToIntBits(float)方法产生的结果完全相同。
代码示例来源:origin: google/guava
/**
* 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();
}
代码示例来源:origin: alibaba/druid
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
代码示例来源:origin: alibaba/druid
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
代码示例来源:origin: prestodb/presto
/**
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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;
}
代码示例来源:origin: google/j2objc
/**
* 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();
}
代码示例来源:origin: org.springframework/spring-core
/**
* 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);
}
代码示例来源:origin: google/guava
@Override
public int hashCode() {
return i.hashCode();
}
代码示例来源:origin: apache/incubator-druid
@Override
public int getUnsortedEncodedKeyComponentHashCode(@Nullable Float key)
{
return DimensionHandlerUtils.nullToZero(key).hashCode();
}
代码示例来源:origin: google/guava
public void testHashCode() {
for (float value : VALUES) {
assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
}
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@Deprecated
public void hashCodeWithFloat() {
float flt = 34.8f;
int expected = (new Float(flt)).hashCode();
assertEquals(expected, ObjectUtils.hashCode(flt));
}
代码示例来源:origin: aws/aws-sdk-java
@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;
}
代码示例来源:origin: aws/aws-sdk-java
@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;
}
代码示例来源:origin: aws/aws-sdk-java
@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;
}
代码示例来源:origin: aws/aws-sdk-java
@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;
}
代码示例来源:origin: aws/aws-sdk-java
@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;
}
代码示例来源:origin: aws/aws-sdk-java
@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;
}
代码示例来源:origin: aws/aws-sdk-java
@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;
}
代码示例来源:origin: org.apache.commons/commons-lang3
@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());
}
内容来源于网络,如有侵权,请联系作者删除!