Tabnine Logo
Set.equals
Code IndexAdd Tabnine to your IDE (free)

How to use
equals
method
in
java.util.Set

Best Java code snippets using java.util.Set.equals (Showing top 20 results out of 17,739)

Refine searchRefine arrow

  • List.equals
  • Map.get
  • Map.keySet
  • Set.add
  • Map.entrySet
origin: google/guava

/** An implementation of {@link Map#equals}. */
static boolean equalsImpl(Map<?, ?> map, Object object) {
 if (map == object) {
  return true;
 } else if (object instanceof Map) {
  Map<?, ?> o = (Map<?, ?>) object;
  return map.entrySet().equals(o.entrySet());
 }
 return false;
}
origin: robolectric/robolectric

@Override
public boolean equals(Object o) {
 if (this == o) return true;
 if (o == null || getClass() != o.getClass()) return false;
 InstrumentationConfiguration that = (InstrumentationConfiguration) o;
 if (!classNameTranslations.equals(that.classNameTranslations)) return false;
 if (!classesToNotAcquire.equals(that.classesToNotAcquire)) return false;
 if (!instrumentedPackages.equals(that.instrumentedPackages)) return false;
 if (!instrumentedClasses.equals(that.instrumentedClasses)) return false;
 if (!interceptedMethods.equals(that.interceptedMethods)) return false;
 return true;
}
origin: commons-collections/commons-collections

public boolean equals(Object obj) {
  return map.keySet().equals(obj);
}
origin: linkedin/cruise-control

private boolean paramEquals(Map<String, String[]> parameters) {
 boolean isSameParameters = _requestParameters.keySet().equals(parameters.keySet());
 if (isSameParameters) {
  for (Map.Entry<String, String[]> entry : _requestParameters.entrySet()) {
   Set<String> param1 = new HashSet<>(Arrays.asList(entry.getValue()));
   Set<String> param2 = new HashSet<>(Arrays.asList(parameters.get(entry.getKey())));
   if (!param1.equals(param2)) {
    return false;
   }
  }
 }
 return isSameParameters;
}
origin: apache/incubator-druid

 public static Map<String, Long> subtract(Map<String, Long> xs, Map<String, Long> ys)
 {
  assert xs.keySet().equals(ys.keySet());
  final Map<String, Long> zs = new HashMap<String, Long>();
  for (String k : xs.keySet()) {
   zs.put(k, xs.get(k) - ys.get(k));
  }
  return zs;
 }
}
origin: apache/storm

for (TopologyDetails topo : topologies.getTopologies()) {
  String id = topo.getId();
  Set<List<Integer>> allExecs = topoToExec.get(id);
  Set<List<Integer>> aliveExecs = topoToAliveExecutors.get(id);
  int numDesiredWorkers = topo.getNumWorkers();
  int numAssignedWorkers = numUsedWorkers(topoToSchedAssignment.get(id));
  if (allExecs == null || allExecs.isEmpty() || !allExecs.equals(aliveExecs) || numDesiredWorkers > numAssignedWorkers) {
    missingAssignmentTopologies.add(id);
for (Entry<String, Map<WorkerSlot, WorkerResources>> uglyWorkerResources : cluster.getWorkerResourcesMap().entrySet()) {
  Map<WorkerSlot, WorkerResources> slotToResources = new HashMap<>();
  for (Entry<WorkerSlot, WorkerResources> uglySlotToResources : uglyWorkerResources.getValue().entrySet()) {
    WorkerResources wr = uglySlotToResources.getValue();
    slotToResources.put(uglySlotToResources.getKey(), wr);
origin: apache/storm

  private boolean shouldPunctuate(String parentStream) {
    punctuationState.add(parentStream);
    return punctuationState.equals(context.getWindowedParentStreams());
  }
}
origin: spring-projects/spring-framework

  String column = JdbcUtils.lookupColumnName(rsmd, index);
  String field = lowerCaseName(StringUtils.delete(column, " "));
  PropertyDescriptor pd = (this.mappedFields != null ? this.mappedFields.get(field) : null);
  if (pd != null) {
    try {
        populatedProperties.add(pd.getName());
if (populatedProperties != null && !populatedProperties.equals(this.mappedProperties)) {
  throw new InvalidDataAccessApiUsageException("Given ResultSet does not contain all fields " +
      "necessary to populate object of class [" + this.mappedClass.getName() + "]: " +
origin: prestodb/presto

this.partitionHandles = ImmutableList.copyOf(partitionHandles);
checkArgument(splitSources.keySet().equals(ImmutableSet.copyOf(schedulingOrder)));
    partitionHandles.equals(ImmutableList.of(NOT_PARTITIONED)) != stageExecutionDescriptor.isStageGroupedExecution(),
    "PartitionHandles should be [NOT_PARTITIONED] if and only if all scan nodes use ungrouped execution strategy");
int nodeCount = nodes.size();
Optional<LifespanScheduler> groupedLifespanScheduler = Optional.empty();
for (PlanNodeId planNodeId : schedulingOrder) {
  SplitSource splitSource = splitSources.get(planNodeId);
  boolean groupedExecutionForScanNode = stageExecutionDescriptor.isScanGroupedExecution(planNodeId);
  SourceScheduler sourceScheduler = newSourcePartitionedSchedulerAsSourceScheduler(
origin: apache/hbase

public List<String> getGroupAuths(String[] groups) {
 this.lock.readLock().lock();
 try {
  List<String> auths = EMPTY_LIST;
  Set<Integer> authOrdinals = getGroupAuthsAsOrdinals(groups);
  if (!authOrdinals.equals(EMPTY_SET)) {
   auths = new ArrayList<>(authOrdinals.size());
   for (Integer authOrdinal : authOrdinals) {
    auths.add(ordinalVsLabels.get(authOrdinal));
   }
  }
  return auths;
 } finally {
  this.lock.readLock().unlock();
 }
}
origin: prestodb/presto

  for (DiskRange mergedRange : mergedRanges) {
    LazyBufferLoader mergedRangeLazyLoader = new LazyBufferLoader(mergedRange);
    for (Entry<K, DiskRange> diskRangeEntry : diskRanges.entrySet()) {
      DiskRange diskRange = diskRangeEntry.getValue();
      if (mergedRange.contains(diskRange)) {
  for (Entry<K, DiskRange> entry : diskRanges.entrySet()) {
    slices.put(entry.getKey(), new OrcDataSourceInput(getDiskRangeSlice(entry.getValue(), buffers).getInput(), entry.getValue().getLength()));
verify(sliceStreams.keySet().equals(diskRanges.keySet()));
return sliceStreams;
origin: apache/geode

    .getAllLocatorsInfo();
if (!allLocators.equals(locators)) {
 for (Map.Entry<Integer, Set<DistributionLocatorId>> entry : locators.entrySet()) {
  Set<DistributionLocatorId> existingValue = allLocators.putIfAbsent(entry.getKey(),
    new CopyOnWriteHashSet<DistributionLocatorId>(entry.getValue()));
   if (!localLocators.equals(entry.getValue())) {
    entry.getValue().removeAll(localLocators);
    for (DistributionLocatorId locator : entry.getValue()) {
     localLocators.add(locator);
     addServerLocator(entry.getKey(), locatorListener, locator);
     locatorListener.locatorJoined(entry.getKey(), locator, null);
origin: apache/geode

@Test
public void testEquals() { // TODO: reduce test runtime
 Set s1, s2;
 s1 = new CompactConcurrentHashSet2();
 s2 = new HashSet();
 for (int i = 0; i < 10000; i++) {
  int nexti = random.nextInt(RANGE);
  s1.add(nexti);
  s2.add(nexti);
  assertTrue("expected s1 and s2 to be equal", s1.equals(s2));
  assertTrue("expected s1 and s2 to be equal", s2.equals(s1));
 }
 assertTrue(s1.hashCode() != 0);
 s2 = new CompactConcurrentHashSet2(2);
 s2.addAll(s1);
 assertTrue("expected s1 and s2 to be equal", s1.equals(s2));
 assertTrue("expected s1 and s2 to be equal", s2.equals(s1));
}
origin: apache/kafka

public MetricName metricInstance(MetricNameTemplate template, Map<String, String> tags) {
  // check to make sure that the runtime defined tags contain all the template tags.
  Set<String> runtimeTagKeys = new HashSet<>(tags.keySet());
  runtimeTagKeys.addAll(config().tags().keySet());
  
  Set<String> templateTagKeys = template.tags();
  
  if (!runtimeTagKeys.equals(templateTagKeys)) {
    throw new IllegalArgumentException("For '" + template.name() + "', runtime-defined metric tags do not match the tags in the template. "
        + "Runtime = " + runtimeTagKeys.toString() + " Template = " + templateTagKeys.toString());
  }
      
  return this.metricName(template.name(), template.group(), template.description(), tags);
}
origin: apache/geode

  || ((this.fixedPAttrs == null) != (other.getFixedPartitionAttributes() == null))
  || (this.fixedPAttrs != null
    && !this.fixedPAttrs.equals(other.getFixedPartitionAttributes()))) {
 return false;
for (int i = 0; i < otherPListeners.length; i++) {
 PartitionListener listener = otherPListeners[i];
 otherListenerClassName.add(listener.getClass().getName());
 thisListenerClassName.add(listener.getClass().getName());
if (!thisListenerClassName.equals(otherListenerClassName)) {
 return false;
origin: debezium/debezium

/**
 * Determine if one or more replica sets has been added or removed since the prior state.
 *
 * @param priorState the prior state of the replica sets; may be null
 * @return {@code true} if the replica sets have changed since the prior state, or {@code false} otherwise
 */
public boolean haveChangedSince(ReplicaSets priorState) {
  if (priorState.replicaSetCount() != this.replicaSetCount()) {
    // At least one replica set has been added or removed ...
    return true;
  }
  if (this.replicaSetsByName.size() != priorState.replicaSetsByName.size()) {
    // The total number of replica sets hasn't changed, but the number of named replica sets has changed ...
    return true;
  }
  // We have the same number of named replica sets ...
  if (!this.replicaSetsByName.isEmpty()) {
    if (!this.replicaSetsByName.keySet().equals(priorState.replicaSetsByName.keySet())) {
      // The replica sets have different names ...
      return true;
    }
    // Otherwise, they have the same names and we don't care about the members ...
  }
  // None of the named replica sets has changed, so we have no choice to be compare the non-replica set members ...
  return this.nonReplicaSets.equals(priorState.nonReplicaSets) ? false : true;
}
origin: linkedin/cruise-control

private boolean hasTheSameHttpParameter(Map<String, String[]> params1, Map<String, String[]> params2) {
 boolean isSameParameters = params1.keySet().equals(params2.keySet());
 if (isSameParameters) {
  for (Map.Entry<String, String[]> entry : params1.entrySet()) {
   Set<String> values1 = new HashSet<>(Arrays.asList(entry.getValue()));
   Set<String> values2 = new HashSet<>(Arrays.asList(params2.get(entry.getKey())));
   if (!values1.equals(values2)) {
    return false;
   }
  }
 }
 return isSameParameters;
}
origin: spring-projects/spring-framework

/**
 * Inspect the {@code expectedModel} to see if all elements in the
 * model appear and are equal.
 * @param mav the ModelAndView to test against (never {@code null})
 * @param expectedModel the expected model
 */
public static void assertModelAttributeValues(ModelAndView mav, Map<String, Object> expectedModel) {
  Map<String, Object> model = mav.getModel();
  if (!model.keySet().equals(expectedModel.keySet())) {
    StringBuilder sb = new StringBuilder("Keyset of expected model does not match.\n");
    appendNonMatchingSetsErrorMessage(expectedModel.keySet(), model.keySet(), sb);
    fail(sb.toString());
  }
  StringBuilder sb = new StringBuilder();
  model.forEach((modelName, mavValue) -> {
    Object assertionValue = expectedModel.get(modelName);
    if (!assertionValue.equals(mavValue)) {
      sb.append("Value under name '").append(modelName).append("' differs, should have been '").append(
        assertionValue).append("' but was '").append(mavValue).append("'\n");
    }
  });
  if (sb.length() != 0) {
    sb.insert(0, "Values of expected model do not match.\n");
    fail(sb.toString());
  }
}
origin: robolectric/robolectric

 LogItem throwLessLogItem = new LogItem(log.type, log.tag, log.msg, null);
 if (expectedLogs.contains(throwLessLogItem)) {
  observedLogs.add(throwLessLogItem);
  continue;
   observedTags.add(log.tag);
   continue;
if (!expectedLogs.equals(observedLogs)) {
 throw new AssertionError(
   "Some expected logs were not printed."
     + observedLogs);
if (!expectedTags.equals(observedTags) && !shouldIgnoreMissingLoggedTags) {
 throw new AssertionError(
   "Some expected tags were not printed. "
origin: prestodb/presto

/** An implementation of {@link Map#equals}. */
static boolean equalsImpl(Map<?, ?> map, Object object) {
 if (map == object) {
  return true;
 } else if (object instanceof Map) {
  Map<?, ?> o = (Map<?, ?>) object;
  return map.entrySet().equals(o.entrySet());
 }
 return false;
}
java.utilSetequals

Javadoc

Compares the specified object to this set, and returns true if they represent the same object using a class specific comparison. Equality for a set means that both sets have the same size and the same elements.

Popular methods of Set

  • add
    Adds the specified element to this set if it is not already present (optional operation). More forma
  • contains
    Returns true if this set contains the specified element. More formally, returns true if and only if
  • iterator
    Returns an iterator over the elements in this set. The elements are returned in no particular order
  • size
  • isEmpty
    Returns true if this set contains no elements.
  • addAll
    Adds all of the elements in the specified collection to this set if they're not already present (opt
  • remove
    Removes the specified element from this set if it is present (optional operation). More formally, re
  • toArray
    Returns an array containing all of the elements in this set; the runtime type of the returned array
  • stream
  • clear
    Removes all of the elements from this set (optional operation). The set will be empty after this cal
  • removeAll
    Removes from this set all of its elements that are contained in the specified collection (optional o
  • forEach
  • removeAll,
  • forEach,
  • containsAll,
  • retainAll,
  • hashCode,
  • removeIf,
  • parallelStream,
  • spliterator,
  • of

Popular in Java

  • Running tasks concurrently on multiple threads
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • getSharedPreferences (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Menu (java.awt)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now