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

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

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

TreeSet.equals介绍

暂无

代码示例

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

/**
 * @param o the other filter to compare with
 * @return true if and only if the fields of the filter that are serialized
 * are equal to the corresponding fields in other.  Used for testing.
 */
@Override
boolean areSerializedFieldsEqual(Filter o) {
 if (o == this) return true;
 if (!(o instanceof MultipleColumnPrefixFilter)) return false;
 MultipleColumnPrefixFilter other = (MultipleColumnPrefixFilter)o;
 return this.sortedPrefixes.equals(other.sortedPrefixes);
}

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

@Override
public boolean equals(Object o)
{
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 PartitionHolder that = (PartitionHolder) o;
 if (!holderSet.equals(that.holderSet)) {
  return false;
 }
 return true;
}

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

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

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

@Override
public boolean equals(Object o)
{
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 ArbitraryGranularitySpec that = (ArbitraryGranularitySpec) o;
 if (!intervals.equals(that.intervals)) {
  return false;
 }
 if (!rollup.equals(that.rollup)) {
  return false;
 }
 return !(queryGranularity != null
      ? !queryGranularity.equals(that.queryGranularity)
      : that.queryGranularity != null);
}

代码示例来源:origin: kevin-wayne/algs4

/**       
 * Compares this set to the specified set.
 * <p>
 * Note that this method declares two empty sets to be equal
 * even if they are parameterized by different generic types.
 * This is consistent with the behavior of {@code equals()} 
 * within Java's Collections framework.
 *       
 * @param  other the other set
 * @return {@code true} if this set equals {@code other};
 *         {@code false} otherwise
 */
@Override
public boolean equals(Object other) {
  if (other == this) return true;
  if (other == null) return false;
  if (other.getClass() != this.getClass()) return false;
  SET that = (SET) other;
  return this.set.equals(that.set);
}

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

@Override
 public boolean equals(@Nullable Object o) {
  if (this == o) {
   return true;
  }
  if (o == null || getClass() != o.getClass()) {
   return false;
  }
  CachedContent that = (CachedContent) o;
  return id == that.id
    && key.equals(that.key)
    && cachedSpans.equals(that.cachedSpans)
    && metadata.equals(that.metadata);
 }
}

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

@Override
public boolean equals(Object other) {
 if (!(other instanceof SortedStructSet)) {
  return false;
 }
 if (!this.structType.equals(((SortedStructSet) other).structType)) {
  return false;
 }
 return super.equals(other);
}

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

@NoWarning("EC")
public boolean testCollection(Collection<String> c, HashSet<String> s, TreeSet<String> s2, Set<String> s3,  Object o) {
  if (c.equals(s))
    return true;
  if (s.equals(c))
    return true;
  if (o.equals(c))
    return true;
  if (s.equals(s2))
    return true;
  if (s2.equals(s3))
    return true;
  return false;
}
@NoWarning("EC")

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

/**
 * For test purposes only. This isn't quite accurate, because I think two RVVs that have
 * effectively same exceptions may represent the exceptions differently. This method is testing
 * for an exact match of exception format. <br>
 */
@Override
public boolean sameAs(RVVException ex) {
 if (!super.sameAs(ex)) {
  return false;
 }
 RVVExceptionT other = (RVVExceptionT) ex;
 if (this.received == null) {
  if (other.received != null && !other.received.isEmpty()) {
   return false;
  }
 } else if (other.received == null || !this.received.equals(other.received)) {
  return false;
 }
 return true;
}

代码示例来源: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: apache/rocketmq

Entry<String, ConsumerRunningInfo> next = it.next();
ConsumerRunningInfo current = next.getValue();
boolean equals = current.getSubscriptionSet().equals(prev.getSubscriptionSet());

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

if (enumCuboids.equals(cuboidSet) == false) {
  throw new IllegalStateException("Expected cuboid set " + enumCuboids + "; but actual cuboid set " + cuboidSet);

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

/**
 * Checks whether the test outputs match the expected outputs.
 * 
 * @param lep
 *          The LineageInfo extracted from the test
 * @param i
 *          The set of input tables
 * @param o
 *          The set of output tables
 */
private void checkOutput(LineageInfo lep, TreeSet<String> i, TreeSet<String> o) {
 if (!i.equals(lep.getInputTableList())) {
  fail("Input table not same");
 }
 if (!o.equals(lep.getOutputTableList())) {
  fail("Output table not same");
 }
}

代码示例来源:origin: org.apache.hbase/hbase-client

/**
 * @param o the other filter to compare with
 * @return true if and only if the fields of the filter that are serialized
 * are equal to the corresponding fields in other.  Used for testing.
 */
@Override
boolean areSerializedFieldsEqual(Filter o) {
 if (o == this) return true;
 if (!(o instanceof MultipleColumnPrefixFilter)) return false;
 MultipleColumnPrefixFilter other = (MultipleColumnPrefixFilter)o;
 return this.sortedPrefixes.equals(other.sortedPrefixes);
}

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

return false;
else if (!treeSet.equals(other.treeSet))
  return false;
if (vector == null)

代码示例来源:origin: KylinOLAP/Kylin

public static int simulateCuboidGeneration(CubeDesc cube) {
  CuboidScheduler scheduler = new CuboidScheduler(cube);
  long baseCuboid = Cuboid.getBaseCuboidId(cube);
  Collection<Long> cuboidSet = new TreeSet<Long>();
  cuboidSet.add(baseCuboid);
  LinkedList<Long> cuboidQueue = new LinkedList<Long>();
  cuboidQueue.push(baseCuboid);
  while (!cuboidQueue.isEmpty()) {
    long cuboid = cuboidQueue.pop();
    Collection<Long> spnanningCuboids = scheduler.getSpanningCuboid(cuboid);
    for (Long sc : spnanningCuboids) {
      boolean notfound = cuboidSet.add(sc);
      if (!notfound) {
        throw new IllegalStateException("Find duplicate spanning cuboid " + sc + " from cuboid " + cuboid);
      }
      cuboidQueue.push(sc);
    }
  }
  TreeSet<Long> enumCuboids = enumCalcCuboidCount(cube);
  if (enumCuboids.equals(cuboidSet) == false) {
    throw new IllegalStateException("Expected cuboid set " + enumCuboids + "; but actual cuboid set " + cuboidSet);
  }
  int mathCount = mathCalcCuboidCount(cube);
  if (mathCount != enumCuboids.size()) {
    throw new IllegalStateException("Math cuboid count " + mathCount + ", but actual cuboid count " + enumCuboids.size());
  }
  return mathCount;
}

代码示例来源:origin: didi/DDMQ

Entry<String, ConsumerRunningInfo> next = it.next();
ConsumerRunningInfo current = next.getValue();
boolean equals = current.getSubscriptionSet().equals(prev.getSubscriptionSet());

代码示例来源:origin: org.apache.kafka/kafka-streams

@Override
public boolean equals(final Object o) {
  if (this == o) {
    return true;
  }
  if (o == null || getClass() != o.getClass()) {
    return false;
  }
  final TopologyDescription that = (TopologyDescription) o;
  return subtopologies.equals(that.subtopologies)
    && globalStores.equals(that.globalStores);
}

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

@Override
public boolean equals(Object obj) {
  if(this == obj)
    return true;
  if(obj instanceof AccumulatedIcons){
    AccumulatedIcons ai = (AccumulatedIcons) obj;
    return ownIcons.equals(ai.ownIcons) && childIcons.equals(ai.childIcons);
  }
  return false;
}

相关文章