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

How to use
containsAll
method
in
java.util.Set

Best Java code snippets using java.util.Set.containsAll (Showing top 20 results out of 14,742)

Refine searchRefine arrow

  • Set.size
  • Map.keySet
  • Set.add
  • Set.contains
  • List.size
  • Map.get
origin: eclipse-vertx/vert.x

@Override
public boolean containsAll(Collection<?> c) {
 return map.keySet().containsAll(c);
}
origin: google/guava

/** An implementation for {@link Set#equals(Object)}. */
static boolean equalsImpl(Set<?> s, @Nullable Object object) {
 if (s == object) {
  return true;
 }
 if (object instanceof Set) {
  Set<?> o = (Set<?>) object;
  try {
   return s.size() == o.size() && s.containsAll(o);
  } catch (NullPointerException | ClassCastException ignored) {
   return false;
  }
 }
 return false;
}
origin: prestodb/presto

public void noMoreSplits(PlanNodeId planNodeId)
{
  if (noMoreSplits.contains(planNodeId)) {
    return;
  }
  noMoreSplits.add(planNodeId);
  if (noMoreSplits.size() < sourceStartOrder.size()) {
    return;
  }
  checkState(noMoreSplits.size() == sourceStartOrder.size());
  checkState(noMoreSplits.containsAll(sourceStartOrder));
  status.setNoMoreLifespans();
}
origin: line/armeria

private OAuth1aToken(Map<String, String> params) {
  // Map builder with default version value.
  final ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
  for (Entry<String, String> param : params.entrySet()) {
    final String key = param.getKey();
    final String value = param.getValue();
    // Empty values are ignored.
    if (!Strings.isNullOrEmpty(value)) {
      final String lowerCased = Ascii.toLowerCase(key);
      if (DEFINED_PARAM_KEYS.contains(lowerCased)) {
        // If given parameter is defined by Oauth1a protocol, add with lower-cased key.
        builder.put(lowerCased, value);
      } else {
        // Otherwise, just add.
        builder.put(key, value);
      }
    }
  }
  this.params = builder.build();
  if (!this.params.keySet().containsAll(REQUIRED_PARAM_KEYS)) {
    final Set<String> missing = Sets.difference(REQUIRED_PARAM_KEYS, this.params.keySet());
    throw new IllegalArgumentException("Missing OAuth1a parameter exists: " + missing);
  }
  try {
    Long.parseLong(this.params.get(OAUTH_TIMESTAMP));
  } catch (NumberFormatException e) {
    throw new IllegalArgumentException(
        "Illegal " + OAUTH_TIMESTAMP + " value: " + this.params.get(OAUTH_TIMESTAMP));
  }
}
origin: junit-team/junit4

/**
 * Orders the descriptions.
 *
 * @return descriptions in order
 */
public List<Description> order(Collection<Description> descriptions)
    throws InvalidOrderingException {
  List<Description> inOrder = ordering.orderItems(
      Collections.unmodifiableCollection(descriptions));
  if (!ordering.validateOrderingIsCorrect()) {
    return inOrder;
  }
  Set<Description> uniqueDescriptions = new HashSet<Description>(descriptions);
  if (!uniqueDescriptions.containsAll(inOrder)) {
    throw new InvalidOrderingException("Ordering added items");
  }
  Set<Description> resultAsSet = new HashSet<Description>(inOrder);
  if (resultAsSet.size() != inOrder.size()) {
    throw new InvalidOrderingException("Ordering duplicated items");
  } else if (!resultAsSet.containsAll(uniqueDescriptions)) {
    throw new InvalidOrderingException("Ordering removed items");
  }
  return inOrder;
}
origin: apache/incubator-druid

         .entity("Request body must contain a map of { partition:endOffset }")
         .build();
} else if (!endOffsets.keySet().containsAll(offsets.keySet())) {
 return Response.status(Response.Status.BAD_REQUEST)
         .entity(
           StringUtils.format(
             "Request contains partitions not being handled by this task, my partitions: %s",
             endOffsets.keySet()
  if (entry.getValue().compareTo(nextOffsets.get(entry.getKey())) < 0) {
   return Response.status(Response.Status.BAD_REQUEST)
           .entity(
               "End offset must be >= current offset for partition [%s] (current: %s)",
               entry.getKey(),
               nextOffsets.get(entry.getKey())
origin: robolectric/robolectric

 @Override
 public Account[] doWork()
   throws OperationCanceledException, IOException, AuthenticatorException {
  if (authenticationErrorOnNextResponse) {
   setAuthenticationErrorOnNextResponse(false);
   throw new AuthenticatorException();
  }
  List<Account> result = new ArrayList<>();
  Account[] accountsByType = getAccountsByType(type);
  for (Account account : accountsByType) {
   Set<String> featureSet = accountFeatures.get(account);
   if (features == null || featureSet.containsAll(Arrays.asList(features))) {
    result.add(account);
   }
  }
  return result.toArray(new Account[result.size()]);
 }
});
origin: apache/kylin

private static void tryDimensionAsMeasures(Collection<FunctionDesc> unmatchedAggregations, CapabilityResult result,
    Set<TblColRef> dimCols) {
  Iterator<FunctionDesc> it = unmatchedAggregations.iterator();
  while (it.hasNext()) {
    FunctionDesc functionDesc = it.next();
    // let calcite handle count
    if (functionDesc.isCount()) {
      it.remove();
      continue;
    }
    // calcite can do aggregation from columns on-the-fly
    ParameterDesc parameterDesc = functionDesc.getParameter();
    if (parameterDesc == null) {
      continue;
    }
    List<TblColRef> neededCols = parameterDesc.getColRefs();
    if (neededCols.size() > 0 && dimCols.containsAll(neededCols)
        && FunctionDesc.BUILT_IN_AGGREGATIONS.contains(functionDesc.getExpression())) {
      result.influences.add(new CapabilityResult.DimensionAsMeasure(functionDesc));
      it.remove();
      continue;
    }
  }
}
origin: org.mongodb/mongo-java-driver

@Override
public boolean containsAll(final Collection collection) {
  Set<Object> values = new HashSet<Object>();
  for (final Object o : this) {
    values.add(o);
  }
  return values.containsAll(collection);
}
origin: spotbugs/spotbugs

@ExpectWarning("DMI")
public static void main(String args[]) {
  Set s = new HashSet();
  s.contains(s);
  s.remove(s);
  s.removeAll(s);
  s.retainAll(s);
  s.containsAll(s);
  Map m = new HashMap();
  m.get(m);
  m.remove(m);
  m.containsKey(m);
  m.containsValue(m);
  List lst = new LinkedList();
  lst.indexOf(lst);
  lst.lastIndexOf(lst);
}
origin: apache/ignite

/**
 * @param presentedNodes Nodes present in cluster.
 * @return {@code True} if current topology satisfies baseline.
 */
public boolean isSatisfied(@NotNull Collection<ClusterNode> presentedNodes) {
  if (presentedNodes.size() < nodeMap.size())
    return false;
  Set<Object> presentedNodeIds = new HashSet<>();
  for (ClusterNode node : presentedNodes)
    presentedNodeIds.add(node.consistentId());
  return presentedNodeIds.containsAll(nodeMap.keySet());
}
origin: spotbugs/spotbugs

  /**
   * @param args
   */
  @ExpectWarning("DMI,GC")
  public static void main(String args[]) {

    Set<A> sa = new HashSet<A>();
    Set<A> sa2 = new HashSet<A>();

    TreeSet<A> tsa2 = new TreeSet<A>();

    sa.contains(sa);
    sa.contains(sa2);
    sa.contains(tsa2);

    sa.containsAll(sa);
    sa.containsAll(sa2);
    sa.containsAll(tsa2);
  }
}
origin: Graylog2/graylog2-server

boolean hasWildcardPermission = permissionSet.contains("*");
if (hasWildcardPermission && !user.getRoleIds().contains(adminRoleId)) {
  fixedRoleIds.add(adminRoleId);
final boolean hasCompleteReaderSet = permissionSet.containsAll(basePermissions);
  continue;
if (hasCompleteReaderSet && !user.getRoleIds().contains(readerRoleId)) {
  fixedRoleIds.add(readerRoleId);
origin: skylot/jadx

private static boolean canSelectNext(IfInfo info, BlockNode block) {
  if (block.getPredecessors().size() == 1) {
    return true;
  }
  if (info.getMergedBlocks().containsAll(block.getPredecessors())) {
    return true;
  }
  return false;
}
origin: stagemonitor/stagemonitor

static void initializePluginsInOrder(Collection<String> disabledPlugins, Iterable<StagemonitorPlugin> plugins) {
  Set<Class<? extends StagemonitorPlugin>> alreadyInitialized = new HashSet<Class<? extends StagemonitorPlugin>>();
  Set<StagemonitorPlugin> notYetInitialized = getPluginsToInit(disabledPlugins, plugins);
  while (!notYetInitialized.isEmpty()) {
    int countNotYetInitialized = notYetInitialized.size();
    // try to init plugins which are
    for (Iterator<StagemonitorPlugin> iterator = notYetInitialized.iterator(); iterator.hasNext(); ) {
      StagemonitorPlugin stagemonitorPlugin = iterator.next();
      {
        final List<Class<? extends StagemonitorPlugin>> dependencies = stagemonitorPlugin.dependsOn();
        if (dependencies.isEmpty() || alreadyInitialized.containsAll(dependencies)) {
          initializePlugin(stagemonitorPlugin);
          iterator.remove();
          alreadyInitialized.add(stagemonitorPlugin.getClass());
        }
      }
    }
    if (countNotYetInitialized == notYetInitialized.size()) {
      // no plugins could be initialized in this try. this probably means there is a cyclic dependency
      throw new IllegalStateException("Cyclic dependencies detected: " + notYetInitialized);
    }
  }
}
origin: ehcache/ehcache3

@Test
public void testKeysForSynchronization() throws Exception {
 final int concurrency = 111;
 ConcurrencyStrategy<EhcacheEntityMessage> strategy = ConcurrencyStrategies.clusterTierConcurrency(DEFAULT_MAPPER);
 Set<Integer> visitedConcurrencyKeys = new HashSet<>();
 for (int i = -1024; i < 1024; i++) {
  int concurrencyKey = strategy.concurrencyKey(new ConcurrentTestEntityMessage(i));
  assertThat(concurrencyKey, withinRange(DEFAULT_KEY, concurrency));
  visitedConcurrencyKeys.add(concurrencyKey);
 }
 Set<Integer> keysForSynchronization = strategy.getKeysForSynchronization();
 assertThat(keysForSynchronization.contains(DEFAULT_KEY), is(true));
 assertThat(keysForSynchronization.containsAll(visitedConcurrencyKeys), is(true));
}
origin: prestodb/presto

@Override
public Void visitIndexJoin(IndexJoinNode node, Set<Symbol> boundSymbols)
{
  node.getProbeSource().accept(this, boundSymbols);
  node.getIndexSource().accept(this, boundSymbols);
  Set<Symbol> probeInputs = createInputs(node.getProbeSource(), boundSymbols);
  Set<Symbol> indexSourceInputs = createInputs(node.getIndexSource(), boundSymbols);
  for (IndexJoinNode.EquiJoinClause clause : node.getCriteria()) {
    checkArgument(probeInputs.contains(clause.getProbe()), "Probe symbol from index join clause (%s) not in probe source (%s)", clause.getProbe(), node.getProbeSource().getOutputSymbols());
    checkArgument(indexSourceInputs.contains(clause.getIndex()), "Index symbol from index join clause (%s) not in index source (%s)", clause.getIndex(), node.getIndexSource().getOutputSymbols());
  }
  Set<Symbol> lookupSymbols = node.getCriteria().stream()
      .map(IndexJoinNode.EquiJoinClause::getIndex)
      .collect(toImmutableSet());
  Map<Symbol, Symbol> trace = IndexKeyTracer.trace(node.getIndexSource(), lookupSymbols);
  checkArgument(!trace.isEmpty() && lookupSymbols.containsAll(trace.keySet()),
      "Index lookup symbols are not traceable to index source: %s",
      lookupSymbols);
  return null;
}
origin: apache/kafka

for (Assignment assigned : assignment.values()) {
  for (TopicPartition tp : assigned.partitions())
    assignedTopics.add(tp.topic());
if (!assignedTopics.containsAll(allSubscribedTopics)) {
  Set<String> notAssignedTopics = new HashSet<>(allSubscribedTopics);
  notAssignedTopics.removeAll(assignedTopics);
if (!allSubscribedTopics.containsAll(assignedTopics)) {
  Set<String> newlyAddedTopics = new HashSet<>(assignedTopics);
  newlyAddedTopics.removeAll(allSubscribedTopics);
origin: SonarSource/sonarqube

 /**
  * Validates tags and resolves conflicts between user and system tags.
  */
 static boolean applyTags(RuleDto rule, Set<String> tags) {
  for (String tag : tags) {
   RuleTagFormat.validate(tag);
  }

  Set<String> initialTags = rule.getTags();
  final Set<String> systemTags = rule.getSystemTags();
  Set<String> withoutSystemTags = Sets.filter(tags, input -> input != null && !systemTags.contains(input));
  rule.setTags(withoutSystemTags);
  return withoutSystemTags.size() != initialTags.size() || !withoutSystemTags.containsAll(initialTags);
 }
}
origin: commons-collections/commons-collections

public void verifyKeySet() { 
  int size = confirmed.size();
  boolean empty = confirmed.isEmpty();
  assertEquals("keySet should be same size as HashMap's" +
         "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
         size, keySet.size());
  assertEquals("keySet should be empty if HashMap is" +
         "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
         empty, keySet.isEmpty());
  assertTrue("keySet should contain all HashMap's elements" +
        "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
        keySet.containsAll(confirmed.keySet()));
  assertEquals("keySet hashCodes should be the same" +
         "\nTest: " + keySet + "\nReal: " + confirmed.keySet(),
         confirmed.keySet().hashCode(), keySet.hashCode());
  assertEquals("Map's key set should still equal HashMap's",
         confirmed.keySet(), keySet);
}
java.utilSetcontainsAll

Javadoc

Searches this set for all objects in the specified collection.

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,
  • equals,
  • 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 PhpStorm plugins
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