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

x33g5p2x  于2022-01-16 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(142)

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

HashSet.hashCode介绍

暂无

代码示例

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

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

代码示例来源:origin: google/j2objc

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

代码示例来源:origin: opentripplanner/OpenTripPlanner

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

代码示例来源:origin: opentripplanner/OpenTripPlanner

@Override
public int hashCode() {
  return agencyAndRouteIds.hashCode() + agencyIdAndRouteNames.hashCode()
      + routeNames.hashCode();
}

代码示例来源:origin: Sable/soot

/**
 * {@inheritDoc}
 */
public int hashCode() {
 final int PRIME = 31;
 int result = 1;
 result = PRIME * result + ((subsets == null) ? 0 : subsets.hashCode());
 return result;
}

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

public void storeOfNull() {
  for (int i = 0; i < 10; i++) {
    HashSet<Integer> set = new HashSet<Integer>();
    set.add(i);
    System.out.println(set.hashCode());
    set = null;
  }
}

代码示例来源:origin: google/guava

private static void checkHashCode(Set<?> set) {
 assertEquals(Sets.newHashSet(set).hashCode(), set.hashCode());
}

代码示例来源:origin: real-logic/agrona

@Test
public void shouldHaveCompatibleEqualsAndHashcode()
{
  final HashSet<Integer> compatibleSet = new HashSet<>();
  final long seed = System.nanoTime();
  final Random r = new Random(seed);
  for (int i = 0; i < 1024; i++)
  {
    final int value = r.nextInt();
    compatibleSet.add(value);
    testSet.add(value);
  }
  assertEquals("Fail with seed:" + seed, testSet, compatibleSet);
  assertEquals("Fail with seed:" + seed, compatibleSet, testSet);
  assertEquals("Fail with seed:" + seed, compatibleSet.hashCode(), testSet.hashCode());
}

代码示例来源:origin: real-logic/agrona

@Test
public void shouldHaveCompatibleEqualsAndHashcode()
{
  final HashSet<Integer> compatibleSet = new HashSet<>();
  final long seed = System.nanoTime();
  final Random r = new Random(seed);
  for (int i = 0; i < 1024; i++)
  {
    final int value = r.nextInt();
    compatibleSet.add(value);
    testSet.add(value);
  }
  if (r.nextBoolean())
  {
    compatibleSet.add(MISSING_VALUE);
    testSet.add(MISSING_VALUE);
  }
  assertEquals("Fail with seed:" + seed, testSet, compatibleSet);
  assertEquals("Fail with seed:" + seed, compatibleSet, testSet);
  assertEquals("Fail with seed:" + seed, compatibleSet.hashCode(), testSet.hashCode());
}

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

result = prime * result + ((deque == null) ? 0 : deque.hashCode());
result = prime * result
    + ((hashSet == null) ? 0 : hashSet.hashCode());
result = prime

代码示例来源:origin: pentaho/mondrian

h = h * 31 + new HashSet<RolapCalculation>(
  Arrays.asList(calculations)
    .subList(0, calculationCount)).hashCode();
h = h * 31 + slicerMembers.hashCode();
h = h * 31 + (expandingMember == null ? 0 : expandingMember.hashCode());

代码示例来源:origin: coherence-community/oracle-bedrock

@Override
public int hashCode()
{
  int result = (autoDeployEnabled ? 1 : 0);
  result = 31 * result + includePaths.hashCode();
  result = 31 * result + excludeFileNames.hashCode();
  return result;
}

代码示例来源:origin: hneemann/Digital

@Override
  public int hashCode() {
    return inputs != null ? inputs.hashCode() : 0;
  }
}

代码示例来源:origin: sweble/sweble-wikitext

@Override
public int hashCode()
{
  final int prime = 31;
  int result = 1;
  result = prime * result + ((name == null) ? 0 : name.hashCode());
  result = prime * result + ((pfns == null) ? 0 : pfns.hashCode());
  return result;
}

代码示例来源:origin: knowitall/reverb

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result
      + ((layerNames == null) ? 0 : layerNames.hashCode());
  result = prime * result + ((layers == null) ? 0 : layers.hashCode());
  result = prime * result + length;
  result = prime * result + numLayers;
  return result;
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

/** @inheritDoc */
  @Override
  public int hashCode() {
    int result;
    result = mode;
    result = 31 * result + strategy.hashCode();
    result = 31 * result + new HashSet<SearchTerm>(Arrays.asList(searchTerms)).hashCode();
    return result;
  }
}

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

/** @inheritDoc */
  @Override
  public int hashCode() {
    int result;
    result = mode;
    result = 31 * result + strategy.hashCode();
    result = 31 * result + new HashSet<SearchTerm>(Arrays.asList(searchTerms)).hashCode();
    return result;
  }
}

代码示例来源:origin: jboss/jboss-javaee-specs

@Override
public int hashCode()
{
 int result = 17;
 result = 37 * result + this.urlPattern.hashCode();
 if (this.urlPatternList != null)
   result = 37 * result + this.urlPatternList.hashCode();
 return result;
}

代码示例来源:origin: org.jboss.spec.javax.security.jacc/jboss-jacc-api_1.4_spec

@Override
public int hashCode()
{
 int result = 17;
 result = 37 * result + this.urlPattern.hashCode();
 if (this.urlPatternList != null)
   result = 37 * result + this.urlPatternList.hashCode();
 return result;
}

代码示例来源:origin: org.batoo.jpa/batoo-jpa

/**
 * {@inheritDoc}
 * 
 */
@Override
public int hashCode() {
  this.initialize();
  return this.delegate.hashCode();
}

相关文章