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

How to use
removeAll
method
in
java.util.Set

Best Java code snippets using java.util.Set.removeAll (Showing top 20 results out of 25,488)

Refine searchRefine arrow

  • Set.add
  • Set.addAll
  • Map.keySet
  • Set.isEmpty
  • Set.size
  • Map.get
  • Map.put
  • Set.contains
origin: prestodb/presto

/**
 * Method for removing specified field properties out of
 * this ObjectNode.
 * 
 * @param fieldNames Names of fields to remove
 * 
 * @return This node after removing entries
 */
public ObjectNode remove(Collection<String> fieldNames)
{
  _children.keySet().removeAll(fieldNames);
  return this;
}

origin: languagetool-org/languagetool

/**
 * Disable the given rules so the check methods like {@link #check(String)} won't use them.
 * @param ruleIds the ids of the rules to disable - no error will be thrown if the id does not exist
 * @since 2.4
 */
public void disableRules(List<String> ruleIds) {
 disabledRules.addAll(ruleIds);
 enabledRules.removeAll(ruleIds);
}
origin: stanfordnlp/CoreNLP

private static <E> void pruneAttributes(Set<E> attrs, Set<E> unknown) {
 if (attrs.size() > unknown.size())
  attrs.removeAll(unknown);
}
origin: knowm/XChange

private String[] filter(String[] original, String[] supported) throws IOException {
 Set<String> filtered = new CopyOnWriteArraySet<>(Arrays.asList(original));
 filtered.removeAll(disabled);
 if (filtered.isEmpty()) {
  filtered.addAll(Arrays.asList(supported));
  filtered.removeAll(disabled);
 }
 if (filtered.isEmpty())
  throw new IOException(
    "No supported SSL attributed enabled.  "
      + Arrays.toString(original)
      + " provided, "
      + disabled.toString()
      + " disabled, "
      + Arrays.toString(supported)
      + " supported, result: "
      + filtered.toString());
 return filtered.toArray(new String[filtered.size()]);
}
origin: stackoverflow.com

 Map<String, String> map = new HashMap<>();
map.put("a", "");
map.put("b", "");
map.put("c", "");

Set<String> set = new HashSet<> ();
set.add("a");
set.add("b");

map.keySet().removeAll(set);

System.out.println(map); //only contains "c"
origin: confluentinc/ksql

@SuppressWarnings("SuspiciousMethodCalls")
@Override
protected boolean matchesSafely(
  final Map<? super K, ? super V> actual,
  final Description mismatchDescription) {
 final Set<? super K> missingKeys = new HashSet<>(items.keySet());
 missingKeys.removeAll(actual.keySet());
 if (!missingKeys.isEmpty()) {
  mismatchDescription
    .appendText("did not contain " + missingKeys.size() + " keys ")
    .appendValue(missingKeys);
  return false;
 }
 // Do not switch to streams, as they can't handle nulls:
 final Map<Object, Object> differentValues = new HashMap<>();
 items.forEach((key, value) -> {
  final Object actualValue = actual.get(key);
  if (!Objects.equal(value, actualValue)) {
   differentValues.put(key, actualValue);
  }
 });
 if (!differentValues.isEmpty()) {
  mismatchDescription
    .appendText("has different values for " + differentValues.size() + " keys ")
    .appendValue(differentValues);
  return false;
 }
 return true;
}
origin: apache/storm

node_res.putAll(n.getResources());
if (!node_res.keySet().equals(resources.keySet())) {
  StringBuilder ops = new StringBuilder();
    Set<String> resource_keys = new HashSet<>(defaults.keySet());
    resource_keys.addAll(nod.getResources().keySet());
    ops.append("\t[ " + nod.shortString() + ", Resources Set: " + resource_keys + " ]\n");
  if (node_res.keySet().containsAll(resources.keySet())) {
    Set<String> diffset = new HashSet<>(node_res.keySet());
    diffset.removeAll(resources.keySet());
    throw new RuntimeException(
      "Found an operation with resources set which are not set in other operations in the group:\n" +
  } else if (resources.keySet().containsAll(node_res.keySet())) {
    Set<String> diffset = new HashSet<>(resources.keySet());
    diffset.removeAll(node_res.keySet());
    throw new RuntimeException(
      "Found an operation with resources unset which are set in other operations in the group:\n" +
  Number val = kv.getValue();
  Number newval = new Double(val.doubleValue() + resources.get(key).doubleValue());
  resources.put(key, newval);
origin: apache/nifi

@Override
public synchronized void unregister(final String connectionId, final NodeIdentifier nodeId) {
  final Set<AsyncLoadBalanceClient> clients = clientMap.get(nodeId);
  if (clients == null) {
    return;
  }
  final Set<AsyncLoadBalanceClient> toRemove = new HashSet<>();
  for (final AsyncLoadBalanceClient client : clients) {
    client.unregister(connectionId);
    if (client.getRegisteredConnectionCount() == 0) {
      toRemove.add(client);
    }
  }
  clients.removeAll(toRemove);
  allClients.removeAll(toRemove);
  if (clients.isEmpty()) {
    clientMap.remove(nodeId);
  }
  logger.debug("Un-registered Connection with ID {} so that it will no longer send data to Node {}; {} clients were removed", connectionId, nodeId, toRemove.size());
}
origin: opentripplanner/OpenTripPlanner

@Override
public void expire(Set<String> purge) {
  for (String patchId : purge) {
    if (alertPatches.containsKey(patchId)) {
      expire(alertPatches.get(patchId));
    }
  }
  alertPatches.keySet().removeAll(purge);
}
origin: btraceio/btrace

@Override
public void visitLabel(Label label) {
  super.visitLabel(label);
  Collection<Label> labels = tryCatchStart.get(label);
  if (labels != null) {
    effectiveHandlers.addAll(labels);
  } else {
    labels = tryCatchEnd.get(label);
    if (labels != null) {
      effectiveHandlers.removeAll(labels);
    } else {
      state.join(label);
      if (handlers.contains(label)) {
        state.push(new InstanceItem(THROWABLE_TYPE));
      }
    }
  }
  visitedLabels.add(label);
}
origin: jenkinsci/jenkins

Map<String,Computer> byName = new HashMap<String,Computer>();
for (Computer c : computers.values()) {
  old.add(c);
  Node node = c.getNode();
  if (node == null)
    continue;   // this computer is gone
  byName.put(node.getNodeName(),c);
Set<Computer> used = new HashSet<>(old.size());
old.removeAll(used);
origin: linkedin/cruise-control

public static boolean hasValidParameters(HttpServletRequest request, HttpServletResponse response) throws IOException {
 EndPoint endPoint = endPoint(request);
 Set<String> validParamNames = VALID_ENDPOINT_PARAM_NAMES.get(endPoint);
 Set<String> userParams = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
 userParams.addAll(request.getParameterMap().keySet());
 if (validParamNames != null) {
  userParams.removeAll(validParamNames);
 }
 if (!userParams.isEmpty()) {
  // User request specifies parameters that are not a subset of the valid parameters.
  String errorResp = String.format("Unrecognized endpoint parameters in %s %s request: %s.",
                   endPoint, request.getMethod(), userParams.toString());
  writeErrorResponse(response, "", errorResp, SC_BAD_REQUEST, wantJSON(request));
  return false;
 }
 return true;
}
origin: ReactiveX/RxJava

for (Thread t : Thread.getAllStackTraces().keySet()) {
  if (t.getName().startsWith("Rx")) {
    rxThreadsBefore.add(t);
    System.out.println("testStartIdempotence >> " + t);
for (Thread t : Thread.getAllStackTraces().keySet()) {
  if (t.getName().startsWith("Rx")) {
    rxThreadsAfter.add(t);
    System.out.println("testStartIdempotence >>>> " + t);
rxThreadsAfter.removeAll(rxThreadsBefore);
Assert.assertTrue("Some new threads appeared: " + rxThreadsAfter, rxThreadsAfter.isEmpty());
origin: prestodb/presto

private synchronized void updateNodes(MemoryPoolAssignmentsRequest assignments)
{
  ImmutableSet.Builder<Node> builder = ImmutableSet.builder();
  Set<Node> aliveNodes = builder
      .addAll(nodeManager.getNodes(ACTIVE))
      .addAll(nodeManager.getNodes(SHUTTING_DOWN))
      .build();
  ImmutableSet<String> aliveNodeIds = aliveNodes.stream()
      .map(Node::getNodeIdentifier)
      .collect(toImmutableSet());
  // Remove nodes that don't exist anymore
  // Make a copy to materialize the set difference
  Set<String> deadNodes = ImmutableSet.copyOf(difference(nodes.keySet(), aliveNodeIds));
  nodes.keySet().removeAll(deadNodes);
  // Add new nodes
  for (Node node : aliveNodes) {
    if (!nodes.containsKey(node.getNodeIdentifier())) {
      nodes.put(node.getNodeIdentifier(), new RemoteNodeMemory(node, httpClient, memoryInfoCodec, assignmentsRequestJsonCodec, locationFactory.createMemoryInfoLocation(node)));
    }
  }
  // If work isn't scheduled on the coordinator (the current node) there is no point
  // in polling or updating (when moving queries to the reserved pool) its memory pools
  if (!isWorkScheduledOnCoordinator) {
    nodes.remove(nodeManager.getCurrentNode().getNodeIdentifier());
  }
  // Schedule refresh
  for (RemoteNodeMemory node : nodes.values()) {
    node.asyncRefresh(assignments);
  }
}
origin: alibaba/jstorm

@SuppressWarnings("unchecked")
private Set<String> getNeedReDownloadTopologies(Map<Integer, LocalAssignment> localAssignment) {
  Set<String> reDownloadTopologies = syncProcesses.getTopologyIdNeedDownload().getAndSet(null);
  if (reDownloadTopologies == null || reDownloadTopologies.size() == 0)
    return null;
  Set<String> needRemoveTopologies = new HashSet<>();
  Map<Integer, String> portToStartWorkerId = syncProcesses.getPortToWorkerId();
  for (Entry<Integer, LocalAssignment> entry : localAssignment.entrySet()) {
    if (portToStartWorkerId.containsKey(entry.getKey()))
      needRemoveTopologies.add(entry.getValue().getTopologyId());
  }
  LOG.debug("workers are starting on these topologies, delay downloading topology binary: " +
      needRemoveTopologies);
  reDownloadTopologies.removeAll(needRemoveTopologies);
  if (reDownloadTopologies.size() > 0)
    LOG.info("Following topologies are going to re-download the jars, " + reDownloadTopologies);
  return reDownloadTopologies;
}
origin: fesh0r/fernflower

private static Set<BasicBlock> getRangeEntries(ExceptionRangeCFG range) {
 Set<BasicBlock> setEntries = new HashSet<>();
 Set<BasicBlock> setRange = new HashSet<>(range.getProtectedRange());
 for (BasicBlock block : range.getProtectedRange()) {
  Set<BasicBlock> setPreds = new HashSet<>(block.getPreds());
  setPreds.removeAll(setRange);
  if (!setPreds.isEmpty()) {
   setEntries.add(block);
  }
 }
 return setEntries;
}
origin: ctripcorp/apollo

private static <T> void classify(Set<T> src, Set<T> des, ClassifyStandard<T> standard) {
 Set<T> set = new HashSet<>();
 for (T t : src) {
  if (standard.satisfy(t)) {
   set.add(t);
  }
 }
 src.removeAll(set);
 des.addAll(set);
}
origin: google/guava

@Override
public boolean removeAll(Collection<?> c) {
 try {
  return super.removeAll(checkNotNull(c));
 } catch (UnsupportedOperationException e) {
  Set<K> toRemove = Sets.newHashSet();
  for (Entry<K, V> entry : map().entrySet()) {
   if (c.contains(entry.getValue())) {
    toRemove.add(entry.getKey());
   }
  }
  return map().keySet().removeAll(toRemove);
 }
}
origin: google/guava

Set<Feature<?>> computeMultimapGetFeatures(Set<Feature<?>> multimapFeatures) {
 Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
 for (Entry<Feature<?>, Feature<?>> entry : GET_FEATURE_MAP.entries()) {
  if (derivedFeatures.contains(entry.getKey())) {
   derivedFeatures.add(entry.getValue());
  }
 }
 if (derivedFeatures.remove(MultimapFeature.VALUE_COLLECTIONS_SUPPORT_ITERATOR_REMOVE)) {
  derivedFeatures.add(CollectionFeature.SUPPORTS_ITERATOR_REMOVE);
 }
 if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
  derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
 }
 derivedFeatures.removeAll(GET_FEATURE_MAP.keySet());
 return derivedFeatures;
}
origin: Tencent/tinker

private Set<String> getIncrementProviders(Collection<String> oldProviders, Collection<String> newProviders) {
  final Set<String> incNames = new HashSet<>(newProviders);
  incNames.removeAll(oldProviders);
  if (!incNames.isEmpty()) {
    announceWarningOrException("found added providers: " + incNames.toString()
        + "\n currently tinker does not support increase new providers, "
        + "such these changes would not take effect.");
  }
  return incNames;
}
java.utilSetremoveAll

Javadoc

Removes all objects in the specified collection from this set.

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
  • 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
  • forEach
  • equals
    Compares the specified object with this set for equality. Returnstrue if the specified object is als
  • forEach,
  • equals,
  • containsAll,
  • retainAll,
  • hashCode,
  • removeIf,
  • parallelStream,
  • spliterator,
  • of

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Kernel (java.awt.image)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top 12 Jupyter Notebook extensions
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