java.util.Objects.hashCode()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中java.util.Objects.hashCode()方法的一些代码示例,展示了Objects.hashCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects.hashCode()方法的具体详情如下:
包路径:java.util.Objects
类名称:Objects
方法名:hashCode

Objects.hashCode介绍

[英]Returns 0 for null or o.hashCode().
[中]返回0表示null或o.hashCode()。

代码示例

代码示例来源:origin: apache/kafka

@Override
public int hashCode() {
  if (hash != 0)
    return hash;
  final int prime = 31;
  int result = 1;
  result = prime * result + partition;
  result = prime * result + Objects.hashCode(topic);
  this.hash = result;
  return result;
}

代码示例来源:origin: prestodb/presto

@Override
public int hashCode()
{
  return Objects.hashCode(ranges);
}

代码示例来源:origin: prestodb/presto

@Override
public int hashCode()
{
  return Objects.hashCode(schemaName);
}

代码示例来源:origin: prestodb/presto

@Override
public int hashCode()
{
  return Objects.hashCode(columns);
}

代码示例来源:origin: prestodb/presto

@Override
public int hashCode()
{
  return Objects.hashCode(token);
}

代码示例来源:origin: prestodb/presto

@Override
public int hashCode()
{
  return Objects.hashCode(domains);
}

代码示例来源:origin: prestodb/presto

@Override
public int hashCode()
{
  return Objects.hashCode(tableMetadata);
}

代码示例来源:origin: square/okhttp

@Override public int hashCode() {
 int result = Objects.hashCode(certificateChainCleaner);
 result = 31 * result + pins.hashCode();
 return result;
}

代码示例来源:origin: neo4j/neo4j

@Override
  public int hashCode()
  {
    return Objects.hashCode( requirementDescription );
  }
}

代码示例来源:origin: apache/flink

@Override
public int hashCode() {
  return Objects.hashCode(schema);
}

代码示例来源:origin: dropwizard/dropwizard

@Override
public int hashCode() {
  return Objects.hashCode(name);
}

代码示例来源:origin: stackoverflow.com

@Override
public int hashCode(){
  return Objects.hashCode(name, length, children);
}

@Override
public boolean equals(final Object obj){
  if(obj instanceof Bean){
    final Bean other = (Bean) obj;
    return Objects.equal(name, other.name)
      && length == other.length // special handling for primitives
      && Objects.equal(children, other.children);
  } else{
    return false;
  }
}

代码示例来源:origin: AsyncHttpClient/async-http-client

@Override
 public int hashCode() {
  return Objects.hashCode(statsPerHost);
 }
}

代码示例来源:origin: square/okhttp

@Override public int hashCode() {
 int result = 17;
 result = 31 * result + url.hashCode();
 result = 31 * result + dns.hashCode();
 result = 31 * result + proxyAuthenticator.hashCode();
 result = 31 * result + protocols.hashCode();
 result = 31 * result + connectionSpecs.hashCode();
 result = 31 * result + proxySelector.hashCode();
 result = 31 * result + Objects.hashCode(proxy);
 result = 31 * result + Objects.hashCode(sslSocketFactory);
 result = 31 * result + Objects.hashCode(hostnameVerifier);
 result = 31 * result + Objects.hashCode(certificatePinner);
 return result;
}

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * {@inheritDoc}
 */
@Override
public int hashCode() {
  int result = super.hashCode();
  result = HASH_SEED * result + Objects.hashCode(registry);
  result = HASH_SEED * result + Objects.hashCode(toPattern);
  return result;
}

代码示例来源:origin: org.apache.commons/commons-lang3

/**
   * {@inheritDoc}
   */
  @Override
  public int hashCode() {
    int result = 71 << 4;
    result |= raw.hashCode();
    result <<= 4;
    result |= Objects.hashCode(useOwner);
    result <<= 8;
    result |= Arrays.hashCode(typeArguments);
    return result;
  }
}

代码示例来源:origin: apache/incubator-druid

private int computeHashCode()
{
 // Start with partitionNum and version hash codes, because they are often little sequential numbers. If they are
 // added in the end of the chain, resulting hashCode of SegmentId could have worse distribution.
 int hashCode = partitionNum;
 // 1000003 is a constant used in Google AutoValue, provides a little better distribution than 31
 hashCode = hashCode * 1000003 + version.hashCode();
 hashCode = hashCode * 1000003 + dataSource.hashCode();
 hashCode = hashCode * 1000003 + Long.hashCode(intervalStartMillis);
 hashCode = hashCode * 1000003 + Long.hashCode(intervalEndMillis);
 hashCode = hashCode * 1000003 + Objects.hashCode(intervalChronology);
 return hashCode;
}

代码示例来源:origin: robolectric/robolectric

@Implementation(minSdk = KITKAT)
@Override
public int hashCode() {
  return Objects.hashCode(simpleMatrix);
}

代码示例来源:origin: checkstyle/checkstyle

@Override
public String toString() {
  return "JavadocNodeImpl["
      + "index=" + index
      + ", type=" + JavadocUtil.getTokenName(type)
      + ", text='" + text + '\''
      + ", lineNumber=" + lineNumber
      + ", columnNumber=" + columnNumber
      + ", children=" + Objects.hashCode(children)
      + ", parent=" + parent + ']';
}

代码示例来源:origin: org.assertj/assertj-core

@Override
public int hashCode() {
 return Objects.hashCode(getKey()) ^ Objects.hashCode(getValue());
}

相关文章