本文整理了Java中java.lang.Boolean.hashCode()
方法的一些代码示例,展示了Boolean.hashCode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Boolean.hashCode()
方法的具体详情如下:
包路径:java.lang.Boolean
类名称:Boolean
方法名:hashCode
[英]Returns an integer hash code for this boolean.
[中]返回此布尔值的整数哈希代码。
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Returns a suitable hash code for this mutable.
*
* @return the hash code returned by <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code>
*/
@Override
public int hashCode() {
return value ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
}
代码示例来源:origin: prestodb/presto
@Override
public int hashCode()
{
return Boolean.hashCode(all);
}
代码示例来源:origin: commons-lang/commons-lang
/**
* Returns a suitable hash code for this mutable.
*
* @return the hash code returned by <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code>
*/
public int hashCode() {
return value ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Return the same value as {@link Boolean#hashCode(boolean)}}.
* @deprecated as of Spring Framework 5.0, in favor of the native JDK 8 variant
*/
@Deprecated
public static int hashCode(boolean bool) {
return Boolean.hashCode(bool);
}
代码示例来源:origin: neo4j/neo4j
/**
* Calculate hash code of a boolean value
* @param value the value to compute hash code for
* @return the hash code of the given value
*/
public static int hashCode( boolean value )
{
return Boolean.hashCode( value );
}
代码示例来源: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 boolean[] array) {
if (array == null) {
return 0;
}
int hash = INITIAL_HASH;
for (boolean element : array) {
hash = MULTIPLIER * hash + Boolean.hashCode(element);
}
return hash;
}
代码示例来源:origin: prestodb/presto
@Override
public int hashCode() {
int h = 1;
if (_id != null) {
h += _id.hashCode();
}
if (_useInput != null) {
h += _useInput.hashCode();
}
return h;
}
代码示例来源:origin: redisson/redisson
@Override
public int hashCode() {
int h = 1;
if (_id != null) {
h += _id.hashCode();
}
if (_useInput != null) {
h += _useInput.hashCode();
}
return h;
}
代码示例来源:origin: apache/flink
@Override
public int hashCode() {
return 31 * Boolean.hashCode(precomputed.immutableTargetType) + Arrays.hashCode(fieldSerializers);
}
代码示例来源:origin: google/guava
@Override
public int hashCode() {
return i.hashCode();
}
代码示例来源:origin: alibaba/druid
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (Boolean.valueOf(parenthesized).hashCode());
result = prime * result + distionOption;
result = prime * result + ((from == null) ? 0 : from.hashCode());
result = prime * result + ((groupBy == null) ? 0 : groupBy.hashCode());
result = prime * result + ((into == null) ? 0 : into.hashCode());
result = prime * result + ((selectList == null) ? 0 : selectList.hashCode());
result = prime * result + ((where == null) ? 0 : where.hashCode());
return result;
}
代码示例来源:origin: apache/incubator-druid
@Override
public int hashCode()
{
int result = intervals.hashCode();
result = 31 * result + rollup.hashCode();
result = 31 * result + (queryGranularity != null ? queryGranularity.hashCode() : 0);
return result;
}
代码示例来源:origin: apache/incubator-druid
@Override
public int hashCode()
{
int result = segmentGranularity.hashCode();
result = 31 * result + queryGranularity.hashCode();
result = 31 * result + rollup.hashCode();
result = 31 * result + (inputIntervals != null ? inputIntervals.hashCode() : 0);
result = 31 * result + (wrappedSpec != null ? wrappedSpec.hashCode() : 0);
return result;
}
代码示例来源:origin: swagger-api/swagger-core
@Override
public int hashCode() {
int result = description != null ? description.hashCode() : 0;
result = 31 * result + (content != null ? content.hashCode() : 0);
result = 31 * result + (required != null ? required.hashCode() : 0);
result = 31 * result + (extensions != null ? extensions.hashCode() : 0);
result = 31 * result + ($ref != null ? $ref.hashCode() : 0);
return result;
}
代码示例来源:origin: alibaba/druid
@Override
public int hashCode() {
int result = methodName != null ? methodName.hashCode() : 0;
result = 31 * result + (int) (methodNameHashCod64 ^ (methodNameHashCod64 >>> 32));
result = 31 * result + (option != null ? option.hashCode() : 0);
result = 31 * result + (arguments != null ? arguments.hashCode() : 0);
result = 31 * result + (keep != null ? keep.hashCode() : 0);
result = 31 * result + (filter != null ? filter.hashCode() : 0);
result = 31 * result + (over != null ? over.hashCode() : 0);
result = 31 * result + (overRef != null ? overRef.hashCode() : 0);
result = 31 * result + (withinGroup != null ? withinGroup.hashCode() : 0);
result = 31 * result + (ignoreNulls != null ? ignoreNulls.hashCode() : 0);
return result;
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void nullSafeHashCodeWithBooleanArray() {
int expected = 31 * 7 + Boolean.TRUE.hashCode();
expected = 31 * expected + Boolean.FALSE.hashCode();
boolean[] array = {true, false};
int actual = ObjectUtils.nullSafeHashCode(array);
assertEquals(expected, actual);
}
代码示例来源:origin: google/guava
public void testHashCode() {
assertEquals(Boolean.TRUE.hashCode(), Booleans.hashCode(true));
assertEquals(Boolean.FALSE.hashCode(), Booleans.hashCode(false));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@Deprecated
public void hashCodeWithBooleanFalse() {
int expected = Boolean.FALSE.hashCode();
assertEquals(expected, ObjectUtils.hashCode(false));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@Deprecated
public void hashCodeWithBooleanTrue() {
int expected = Boolean.TRUE.hashCode();
assertEquals(expected, ObjectUtils.hashCode(true));
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testHashCode() {
final MutableBoolean mutBoolA = new MutableBoolean(false);
final MutableBoolean mutBoolB = new MutableBoolean(false);
final MutableBoolean mutBoolC = new MutableBoolean(true);
assertEquals(mutBoolA.hashCode(), mutBoolA.hashCode());
assertEquals(mutBoolA.hashCode(), mutBoolB.hashCode());
assertFalse(mutBoolA.hashCode() == mutBoolC.hashCode());
assertEquals(mutBoolA.hashCode(), Boolean.FALSE.hashCode());
assertEquals(mutBoolC.hashCode(), Boolean.TRUE.hashCode());
}
内容来源于网络,如有侵权,请联系作者删除!