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

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

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

HashSet.equals介绍

暂无

代码示例

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

@Override public boolean equals(Object o) {
  if (!(o instanceof HashCodeAndEqualsSafeSet)) {
    return false;
  }
  HashCodeAndEqualsSafeSet that = (HashCodeAndEqualsSafeSet) o;
  return backingHashSet.equals(that.backingHashSet);
}

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

@Override public boolean equals(Object o) {
  if (!(o instanceof HashCodeAndEqualsSafeSet)) {
    return false;
  }
  HashCodeAndEqualsSafeSet that = (HashCodeAndEqualsSafeSet) o;
  return backingHashSet.equals(that.backingHashSet);
}

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

@Override
public boolean equals(Object another) {
  if (another == null || !(another instanceof StopMatcher)) {
    return false;
  }
  if (another == this) {
    return true;
  }
  StopMatcher anotherMatcher = (StopMatcher) another;
  return agencyAndStopIds.equals(anotherMatcher.agencyAndStopIds);
}

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

@Override
public boolean equals(Object another) {
  if (another == null || !(another instanceof RouteMatcher))
    return false;
  if (another == this)
    return true;
  RouteMatcher anotherMatcher = (RouteMatcher) another;
  return agencyAndRouteIds.equals(anotherMatcher.agencyAndRouteIds)
      && agencyIdAndRouteNames.equals(anotherMatcher.agencyIdAndRouteNames)
      && routeNames.equals(anotherMatcher.routeNames);
}

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

public boolean isEquivTo(RWSet other) {
  if (!(other instanceof SiteRWSet)) {
   return false;
  }
  SiteRWSet o = (SiteRWSet) other;
  if (o.callsNative != callsNative) {
   return false;
  }
  return o.sets.equals(sets);
 }
}

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

@Override
public boolean equals(Object other) {
 if (other == this) {
  return true;
 }
 if (!(other instanceof ResultsSet)) {
  return false;
 }
 if (!this.elementType.equals(((ResultsSet) other).elementType)) {
  return false;
 }
 return super.equals(other);
}

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

public boolean equals(Object o) {
  if (o == null) return false;
  if (o.getClass()!=this.getClass()) return false;
  JobStateTransitions that = (JobStateTransitions) o;
  return new HashSet<>(this).equals(new HashSet<>(that));
}

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

static int compareSignature(Signature[] signatures1, Signature[] signatures2) {
 if (signatures1 == null) {
  return (signatures2 == null) ? SIGNATURE_NEITHER_SIGNED : SIGNATURE_FIRST_NOT_SIGNED;
 }
 if (signatures2 == null) {
  return SIGNATURE_SECOND_NOT_SIGNED;
 }
 if (signatures1.length != signatures2.length) {
  return SIGNATURE_NO_MATCH;
 }
 HashSet<Signature> signatures1set = new HashSet<>(asList(signatures1));
 HashSet<Signature> signatures2set = new HashSet<>(asList(signatures2));
 return signatures1set.equals(signatures2set) ? SIGNATURE_MATCH : SIGNATURE_NO_MATCH;
}

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

private static boolean groupsOnAllColumns(AggregationNode node, List<Symbol> columns)
{
  return new HashSet<>(node.getGroupingKeys()).equals(new HashSet<>(columns));
}

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

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  ScheduleOptions that = (ScheduleOptions) o;
  if (specifiedRevisions != null ? !specifiedRevisions.equals(that.specifiedRevisions) : that.specifiedRevisions != null) {
    return false;
  }
  // `Set` because we explicitly want to ignore ordering while comparing, for tests
  if (variables != null ? !new HashSet<>(variables).equals(new HashSet<>(that.variables)) : that.variables != null) {
    return false;
  }
  return true;
}

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

@ExpectWarning("EC_UNRELATED_TYPES")
public boolean test(HashSet<Integer> s1, HashSet<String> s2) {
  return s1.equals(s2);
}
@ExpectWarning("GC_UNRELATED_TYPES")

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

@NoWarning("EC_UNRELATED_TYPES")
public boolean test(HashSet<Integer> s1, TreeSet<Integer> s2) {
  return s1.equals(s2);
}
@ExpectWarning("EC_UNRELATED_TYPES")

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

@ExpectWarning("EC_UNRELATED_TYPES")
static boolean test3(HashSet<Integer> s, LinkedList<String> lst) {
  return s.equals(lst);
}

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

@ExpectWarning("EC_UNRELATED_TYPES")
static boolean test1(HashSet<Integer> s, LinkedList<Integer> lst) {
  return s.equals(lst);
}

代码示例来源:origin: remkop/picocli

public boolean equals(Object obj) {
  if (obj == this) { return true; }
  if (!(obj instanceof OptionSpec)) { return false; }
  OptionSpec other = (OptionSpec) obj;
  boolean result = super.equalsImpl(other)
      && help == other.help
      && usageHelp == other.usageHelp
      && versionHelp == other.versionHelp
      && order == other.order
      && new HashSet<String>(Arrays.asList(names)).equals(new HashSet<String>(Arrays.asList(other.names)));
  return result;
}
public int hashCode() {

代码示例来源:origin: com.h2database/h2

private static boolean canUseUniqueIndex(Index idx, Table table, IndexColumn[] cols) {
  if (idx.getTable() != table || !idx.getIndexType().isUnique()) {
    return false;
  }
  Column[] indexCols = idx.getColumns();
  HashSet<Column> indexColsSet = new HashSet<>();
  Collections.addAll(indexColsSet, indexCols);
  HashSet<Column> colsSet = new HashSet<>();
  for (IndexColumn c : cols) {
    colsSet.add(c.column);
  }
  return colsSet.equals(indexColsSet);
}

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

public void testEquals_bothDefaultOrdering() {
 SortedSet<String> set = of("a", "b", "c");
 assertEquals(set, Sets.newTreeSet(asList("a", "b", "c")));
 assertEquals(Sets.newTreeSet(asList("a", "b", "c")), set);
 assertFalse(set.equals(Sets.newTreeSet(asList("a", "b", "d"))));
 assertFalse(Sets.newTreeSet(asList("a", "b", "d")).equals(set));
 assertFalse(set.equals(Sets.newHashSet(4, 5, 6)));
 assertFalse(Sets.newHashSet(4, 5, 6).equals(set));
}

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

public void testEquals_bothExplicitOrdering() {
 SortedSet<String> set = of("in", "the", "a");
 assertEquals(Sets.newTreeSet(asList("in", "the", "a")), set);
 assertFalse(set.equals(Sets.newTreeSet(asList("in", "the", "house"))));
 assertFalse(Sets.newTreeSet(asList("in", "the", "house")).equals(set));
 assertFalse(set.equals(Sets.newHashSet(4, 5, 6)));
 assertFalse(Sets.newHashSet(4, 5, 6).equals(set));
 Set<String> complex = Sets.newTreeSet(STRING_LENGTH);
 Collections.addAll(complex, "in", "the", "a");
 assertEquals(set, complex);
}

代码示例来源:origin: com.h2database/h2

private static ConstraintUnique lookupUniqueForReferential(ConstraintReferential referential) {
  Table table = referential.getRefTable();
  for (Constraint c : table.getConstraints()) {
    if (c.getConstraintType() == Constraint.Type.UNIQUE) {
      ConstraintUnique unique = (ConstraintUnique) c;
      if (unique.getReferencedColumns(table).equals(referential.getReferencedColumns(table))) {
        return unique;
      }
    }
  }
  return null;
}

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

public PlanNode replace(int group, PlanNode node, String reason)
{
  PlanNode old = getGroup(group).membership;
  checkArgument(new HashSet<>(old.getOutputSymbols()).equals(new HashSet<>(node.getOutputSymbols())),
      "%s: transformed expression doesn't produce same outputs: %s vs %s",
      reason,
      old.getOutputSymbols(),
      node.getOutputSymbols());
  if (node instanceof GroupReference) {
    node = getNode(((GroupReference) node).getGroupId());
  }
  else {
    node = insertChildrenAndRewrite(node);
  }
  incrementReferenceCounts(node, group);
  getGroup(group).membership = node;
  decrementReferenceCounts(old, group);
  evictStatisticsAndCost(group);
  return node;
}

相关文章