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

How to use
addAll
method
in
java.util.Set

Best Java code snippets using java.util.Set.addAll (Showing top 20 results out of 81,981)

Refine searchRefine arrow

  • Set.add
  • Arrays.asList
  • Set.size
  • Map.get
  • Map.put
  • Set.contains
  • Set.isEmpty
  • Map.keySet
origin: square/okhttp

public void redactHeader(String name) {
 Set<String> newHeadersToRedact = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
 newHeadersToRedact.addAll(headersToRedact);
 newHeadersToRedact.add(name);
 headersToRedact = newHeadersToRedact;
}
origin: spring-projects/spring-framework

/**
 * Update the exposed {@link #cacheNames} set with the given name.
 * <p>This will always be called within a full {@link #cacheMap} lock
 * and effectively behaves like a {@code CopyOnWriteArraySet} with
 * preserved order but exposed as an unmodifiable reference.
 * @param name the name of the cache to be added
 */
private void updateCacheNames(String name) {
  Set<String> cacheNames = new LinkedHashSet<>(this.cacheNames.size() + 1);
  cacheNames.addAll(this.cacheNames);
  cacheNames.add(name);
  this.cacheNames = Collections.unmodifiableSet(cacheNames);
}
origin: stackoverflow.com

 Set<String> set = new HashSet<>();
set.addAll(Arrays.asList("leo","bale","hanks"));
Predicate<String> pred = set::contains;
boolean exists = pred.test("leo");
origin: gocd/gocd

private void handleDependencyMaterial(Set<String> scmMaterialSet, DependencyMaterialConfig depMaterial, DependencyFanInNode node, Set<DependencyMaterialConfig> visitedNodes) {
  if (visitedNodes.contains(depMaterial)) {
    scmMaterialSet.addAll(dependencyMaterialFingerprintMap.get(depMaterial));
    return;
  }
  visitedNodes.add(depMaterial);
  final Set<String> scmMaterialFingerprintSet = new HashSet<>();
  buildRestOfTheGraph(node, cruiseConfig.pipelineConfigByName(depMaterial.getPipelineName()), scmMaterialFingerprintSet, visitedNodes);
  dependencyMaterialFingerprintMap.put(depMaterial, scmMaterialFingerprintSet);
  scmMaterialSet.addAll(scmMaterialFingerprintSet);
}
origin: stanfordnlp/CoreNLP

public void addSeedWords(String label, Collection<CandidatePhrase> seeds) throws Exception {
 if(!seedLabelDictionary.containsKey(label)){
  throw new Exception("label not present in the model");
 }
 Set<CandidatePhrase> seedWords = new HashSet<>(seedLabelDictionary.get(label));
 seedWords.addAll(seeds);
 seedLabelDictionary.put(label, Collections.unmodifiableSet(seedWords));
}
origin: stackoverflow.com

Set<Integer> numbers = new TreeSet<Integer>();
 numbers.add(2);
 numbers.add(5);
 System.out.println(numbers); // "[2, 5]"
 System.out.println(numbers.contains(7)); // "false"
 System.out.println(numbers.add(5)); // "false"
 System.out.println(numbers.size()); // "2"
 int sum = 0;
 for (int n : numbers) {
   sum += n;
 }
 System.out.println("Sum = " + sum); // "Sum = 7"
 numbers.addAll(Arrays.asList(1,2,3,4,5));
 System.out.println(numbers); // "[1, 2, 3, 4, 5]"
 numbers.removeAll(Arrays.asList(4,5,6,7));
 System.out.println(numbers); // "[1, 2, 3]"
 numbers.retainAll(Arrays.asList(2,3,4,5));
 System.out.println(numbers); // "[2, 3]"
origin: apache/geode

private void unregisterClientIDFromMap(Long clientID, Map interestMap, Set keysUnregistered) {
 if (interestMap.get(clientID) != null) {
  Map removed = (Map) interestMap.remove(clientID);
  if (removed != null) {
   keysUnregistered.addAll(removed.keySet());
  }
 }
}
origin: stanfordnlp/CoreNLP

  if (!cl.ner().equals(ne)) continue;
 neStrings.add(m.lowercaseNormalizedSpanString());
Map<Integer, Set<Mention>> headPositions = Generics.newHashMap();
for (Mention p : predicts) {
 if (!headPositions.containsKey(p.headIndex)) headPositions.put(p.headIndex, Generics.newHashSet());
 headPositions.get(p.headIndex).add(p);
for (int hPos : headPositions.keySet()) {
 Set<Mention> shares = headPositions.get(hPos);
 if (shares.size() > 1) {
  Counter<Mention> probs = new ClassicCounter<>();
  for (Mention p : shares) {
  remove.addAll(probs.keySet());
origin: apache/hive

/**
 * add allowed functions per column
 * @param columnName
 * @param udfs
 */
public void addComparisonOp(String columnName, String... udfs) {
 Set<String> allowed = columnToUDFs.get(columnName);
 if (allowed == null || allowed == udfNames) {
  // override
  columnToUDFs.put(columnName, new HashSet<String>(Arrays.asList(udfs)));
 } else {
  allowed.addAll(Arrays.asList(udfs));
 }
}
origin: spring-projects/spring-framework

  String attrName = (String) attrNames.nextElement();
  if (this.cleanupAfterInclude || attrName.startsWith(DEFAULT_STRATEGIES_PREFIX)) {
    attrsToCheck.add(attrName);
attrsToCheck.addAll((Set<String>) attributesSnapshot.keySet());
  Object attrValue = attributesSnapshot.get(attrName);
  if (attrValue == null){
    request.removeAttribute(attrName);
origin: stackoverflow.com

public static <K,R,S,T> Map<K, R> zipWith(Function2<R,S,T> fn, 
    Map<K, S> m1, Map<K, T> m2, Map<K, R> results){
  Set<K> keySet = new HashSet<K>();
  keySet.addAll(m1.keySet());
  keySet.addAll(m2.keySet());
  results.clear();
  for (K key : keySet) {
    results.put(key, fn.eval(m1.get(key), m2.get(key)));
  }
  return results;
 }
origin: apache/nifi

private Set<AsyncLoadBalanceClient> registerClients(final NodeIdentifier nodeId) {
  final Set<AsyncLoadBalanceClient> clients = new HashSet<>();
  for (int i=0; i < clientsPerNode; i++) {
    final AsyncLoadBalanceClient client = clientFactory.createClient(nodeId);
    clients.add(client);
    logger.debug("Added client {} for communicating with Node {}", client, nodeId);
  }
  clientMap.put(nodeId, clients);
  allClients.addAll(clients);
  if (running) {
    clients.forEach(AsyncLoadBalanceClient::start);
  }
  return clients;
}
origin: vipshop/vjtools

private synchronized NameValueMap getCachedAttributes(ObjectName objName, Set<String> attrNames)
    throws InstanceNotFoundException, ReflectionException, IOException {
  NameValueMap values = cachedValues.get(objName);
  if (values != null && values.keySet().containsAll(attrNames)) {
    return values;
  }
  attrNames = new TreeSet<String>(attrNames);
  Set<String> oldNames = cachedNames.get(objName);
  if (oldNames != null) {
    attrNames.addAll(oldNames);
  }
  values = new NameValueMap();
  final AttributeList attrs = conn.getAttributes(objName, attrNames.toArray(new String[attrNames.size()]));
  for (Attribute attr : attrs.asList()) {
    values.put(attr.getName(), attr.getValue());
  }
  cachedValues.put(objName, values);
  cachedNames.put(objName, attrNames);
  return values;
}
origin: apache/incubator-dubbo

private Set<String> getPackagesToScan(AnnotationMetadata metadata) {
  AnnotationAttributes attributes = AnnotationAttributes.fromMap(
      metadata.getAnnotationAttributes(CompatibleDubboComponentScan.class.getName()));
  String[] basePackages = attributes.getStringArray("basePackages");
  Class<?>[] basePackageClasses = attributes.getClassArray("basePackageClasses");
  String[] value = attributes.getStringArray("value");
  // Appends value array attributes
  Set<String> packagesToScan = new LinkedHashSet<String>(Arrays.asList(value));
  packagesToScan.addAll(Arrays.asList(basePackages));
  for (Class<?> basePackageClass : basePackageClasses) {
    packagesToScan.add(ClassUtils.getPackageName(basePackageClass));
  }
  if (packagesToScan.isEmpty()) {
    return Collections.singleton(ClassUtils.getPackageName(metadata.getClassName()));
  }
  return packagesToScan;
}
origin: spring-projects/spring-framework

/**
 * Validate that the specified bean name and aliases have not been used already
 * within the current level of beans element nesting.
 */
protected void checkNameUniqueness(String beanName, List<String> aliases, Element beanElement) {
  String foundName = null;
  if (StringUtils.hasText(beanName) && this.usedNames.contains(beanName)) {
    foundName = beanName;
  }
  if (foundName == null) {
    foundName = CollectionUtils.findFirstMatch(this.usedNames, aliases);
  }
  if (foundName != null) {
    error("Bean name '" + foundName + "' is already used in this <beans> element", beanElement);
  }
  this.usedNames.add(beanName);
  this.usedNames.addAll(aliases);
}
origin: apache/storm

public static Map<GlobalStreamId, Grouping> eventLoggerInputs(StormTopology topology) {
  Map<GlobalStreamId, Grouping> inputs = new HashMap<GlobalStreamId, Grouping>();
  Set<String> allIds = new HashSet<String>();
  allIds.addAll(topology.get_bolts().keySet());
  allIds.addAll(topology.get_spouts().keySet());
  for (String id : allIds) {
    inputs.put(Utils.getGlobalStreamId(id, EVENTLOGGER_STREAM_ID),
          Thrift.prepareFieldsGrouping(Arrays.asList("component-id")));
  }
  return inputs;
}
origin: MovingBlocks/Terasology

private Set<EventHandlerInfo> selectEventHandlers(Class<? extends Event> eventType, EntityRef entity) {
  Set<EventHandlerInfo> result = Sets.newHashSet();
  result.addAll(generalHandlers.get(eventType));
  SetMultimap<Class<? extends Component>, EventHandlerInfo> handlers = componentSpecificHandlers.get(eventType);
  if (handlers == null) {
    return result;
  }
  for (Class<? extends Component> compClass : handlers.keySet()) {
    if (entity.hasComponent(compClass)) {
      for (EventHandlerInfo eventHandler : handlers.get(compClass)) {
        if (eventHandler.isValidFor(entity)) {
          result.add(eventHandler);
        }
      }
    }
  }
  return result;
}
origin: stanfordnlp/CoreNLP

/** The format of the demonyms file is
 *     countryCityOrState ( TAB demonym )*
 *  Lines starting with # are ignored
 *  The file is cased but stored in in-memory data structures uncased.
 *  The results are:
 *  demonyms is a has from each country (etc.) to a set of demonymic Strings;
 *  adjectiveNation is a set of demonymic Strings;
 *  demonymSet has all country (etc.) names and all demonymic Strings.
 */
private void loadDemonymLists(String demonymFile) {
 try (BufferedReader reader = IOUtils.readerFromString(demonymFile)) {
  for (String line; (line = reader.readLine()) != null; ) {
   line = line.toLowerCase(Locale.ENGLISH);
   String[] tokens = line.split("\t");
   if (tokens[0].startsWith("#")) continue;
   Set<String> set = Generics.newHashSet();
   for (String s : tokens) {
    set.add(s);
    demonymSet.add(s);
   }
   demonyms.put(tokens[0], set);
  }
  adjectiveNation.addAll(demonymSet);
  adjectiveNation.removeAll(demonyms.keySet());
 } catch (IOException e) {
  throw new RuntimeIOException(e);
 }
}
origin: spring-projects/spring-framework

public DestinationPatternsMessageCondition combine(DestinationPatternsMessageCondition other) {
  Set<String> result = new LinkedHashSet<>();
  if (!this.patterns.isEmpty() && !other.patterns.isEmpty()) {
    for (String pattern1 : this.patterns) {
      for (String pattern2 : other.patterns) {
        result.add(this.pathMatcher.combine(pattern1, pattern2));
  else if (!this.patterns.isEmpty()) {
    result.addAll(this.patterns);
  else if (!other.patterns.isEmpty()) {
    result.addAll(other.patterns);
    result.add("");
origin: google/guava

 @Override
 TypeVariable<?> captureAsTypeVariable(Type[] upperBounds) {
  Set<Type> combined = new LinkedHashSet<>(asList(upperBounds));
  // Since this is an artifically generated type variable, we don't bother checking
  // subtyping between declared type bound and actual type bound. So it's possible that we
  // may generate something like <capture#1-of ? extends Foo&SubFoo>.
  // Checking subtype between declared and actual type bounds
  // adds recursive isSubtypeOf() call and feels complicated.
  // There is no contract one way or another as long as isSubtypeOf() works as expected.
  combined.addAll(asList(typeParam.getBounds()));
  if (combined.size() > 1) { // Object is implicit and only useful if it's the only bound.
   combined.remove(Object.class);
  }
  return super.captureAsTypeVariable(combined.toArray(new Type[0]));
 }
};
java.utilSetaddAll

Javadoc

Adds the objects in the specified collection which do not exist yet in 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
    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.
  • 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
  • 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

  • Finding current android device location
  • compareTo (BigDecimal)
  • getApplicationContext (Context)
  • startActivity (Activity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JTextField (javax.swing)
  • Top Vim 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