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

How to use
contains
method
in
java.util.Set

Best Java code snippets using java.util.Set.contains (Showing top 20 results out of 146,673)

Refine searchRefine arrow

  • Set.add
  • Map.get
  • List.add
  • Map.put
  • Set.size
  • List.size
origin: google/guava

@Override
public int size() {
 int size = set1.size();
 for (E e : set2) {
  if (!set1.contains(e)) {
   size++;
  }
 }
 return size;
}
origin: spring-projects/spring-framework

protected boolean isMatch(Method method, String beanKey) {
  if (this.methodMappings != null) {
    Set<String> methodNames = this.methodMappings.get(beanKey);
    if (methodNames != null) {
      return methodNames.contains(method.getName());
    }
  }
  return (this.managedMethods != null && this.managedMethods.contains(method.getName()));
}
origin: spring-projects/spring-framework

private static List<TypeElement> staticTypesIn(Iterable<? extends Element> elements) {
  List<TypeElement> list = new ArrayList<>();
  for (Element element : elements) {
    if (TYPE_KINDS.contains(element.getKind()) && element.getModifiers().contains(Modifier.STATIC)) {
      list.add(TypeElement.class.cast(element));
    }
  }
  return list;
}
origin: spring-projects/spring-framework

@Test
public void testCircularCollectionBeansStartingWithSet() {
  this.beanFactory.getBean("circularSet");
  TestBean bean = (TestBean) this.beanFactory.getBean("circularCollectionBeansBean");
  List list = bean.getSomeList();
  assertFalse(Proxy.isProxyClass(list.getClass()));
  assertEquals(1, list.size());
  assertEquals(bean, list.get(0));
  Set set = bean.getSomeSet();
  assertTrue(Proxy.isProxyClass(set.getClass()));
  assertEquals(1, set.size());
  assertTrue(set.contains(bean));
  Map map = bean.getSomeMap();
  assertFalse(Proxy.isProxyClass(map.getClass()));
  assertEquals(1, map.size());
  assertEquals(bean, map.get("foo"));
}
origin: gocd/gocd

private void ensureInitializerInvoked(GoPluginDescriptor pluginDescriptor, GoPlugin plugin, String extensionType) {
  synchronized (initializedPluginsWithTheirExtensionTypes) {
    if (initializedPluginsWithTheirExtensionTypes.get(pluginDescriptor) == null) {
      initializedPluginsWithTheirExtensionTypes.put(pluginDescriptor, new HashSet<>());
    }
    Set<String> initializedExtensions = initializedPluginsWithTheirExtensionTypes.get(pluginDescriptor);
    if (initializedExtensions == null || initializedExtensions.contains(extensionType)) {
      return;
    }
    initializedPluginsWithTheirExtensionTypes.get(pluginDescriptor).add(extensionType);
    PluginAwareDefaultGoApplicationAccessor accessor = new PluginAwareDefaultGoApplicationAccessor(pluginDescriptor, requestProcesRegistry);
    plugin.initializeGoApplicationAccessor(accessor);
  }
}
origin: apache/storm

public static List<String> getRepeat(List<String> list) {
  List<String> rtn = new ArrayList<String>();
  Set<String> idSet = new HashSet<String>();
  for (String id : list) {
    if (idSet.contains(id)) {
      rtn.add(id);
    } else {
      idSet.add(id);
    }
  }
  return rtn;
}
origin: skylot/jadx

public List<LoopInfo> getAllLoopsForBlock(BlockNode block) {
  if (loops.isEmpty()) {
    return Collections.emptyList();
  }
  List<LoopInfo> list = new ArrayList<>(loops.size());
  for (LoopInfo loop : loops) {
    if (loop.getLoopBlocks().contains(block)) {
      list.add(loop);
    }
  }
  return list;
}
origin: org.assertj/assertj-core

private static boolean noNonMatchingModifier(Set<String> expectedMethodNames, Map<String, Integer> methodsModifier,
                       Map<String, String> nonMatchingModifiers, int modifier) {
 for (String method : methodsModifier.keySet()) {
  if (expectedMethodNames.contains(method) && (methodsModifier.get(method) & modifier) == 0) {
   nonMatchingModifiers.put(method, Modifier.toString(methodsModifier.get(method)));
  }
 }
 return nonMatchingModifiers.isEmpty();
}
origin: thinkaurelius/titan

private void cleanup() {
  if (deleted==null || deleted.isEmpty()) return;
  Set<InternalRelation> deletedSet = new HashSet<InternalRelation>(deleted);
  deleted=null;
  List<InternalRelation> newadded = new ArrayList<InternalRelation>(added.size()-deletedSet.size()/2);
  for (InternalRelation r : added) {
    if (!deletedSet.contains(r)) newadded.add(r);
  }
  added=newadded;
}
origin: robolectric/robolectric

@Implementation(minSdk = JELLY_BEAN_MR2)
protected Account[] getAccountsByTypeForPackage(String type, String packageName) {
 List<Account> result = new ArrayList<>();
 Account[] accountsByType = getAccountsByType(type);
 for (Account account : accountsByType) {
  if (packageVisibileAccounts.containsKey(account) && packageVisibileAccounts.get(account).contains(packageName)) {
   result.add(account);
  }
 }
 return result.toArray(new Account[result.size()]);
}
origin: skylot/jadx

/**
 * @return true if this value is duplicated
 */
public boolean put(Object value, FieldNode fld) {
  FieldNode prev = values.put(value, fld);
  if (prev != null) {
    values.remove(value);
    duplicates.add(value);
    return true;
  }
  if (duplicates.contains(value)) {
    values.remove(value);
    return true;
  }
  return false;
}
origin: stanfordnlp/CoreNLP

private static List<Sieve.MentionData> eliminateDuplicates(List<Sieve.MentionData> mentionCandidates)
{
 List<Sieve.MentionData> newList = new ArrayList<>();
 Set<String> seenText = new HashSet<>();
 for(int i = 0; i < mentionCandidates.size(); i++)
 {
  Sieve.MentionData mentionCandidate = mentionCandidates.get(i);
  String text = mentionCandidate.text;
  if(!seenText.contains(text) || mentionCandidate.type.equals("Pronoun"))
   newList.add(mentionCandidate);
  seenText.add(text);
 }
 return newList;
}
origin: org.testng/testng

private static List<ITestNGMethod> retrieve(Set<String> tracker, Map<String, List<ITestNGMethod>> map, String group) {
 if (tracker.contains(group)) {
  return Collections.EMPTY_LIST;
 }
 tracker.add(group);
 return map.get(group);
}
origin: eclipse-vertx/vert.x

public DefaultCommandLine addRawValue(Option option, String value) {
 if (!acceptMoreValues(option) && !option.isFlag()) {
  throw new CLIException("The option " + option.getName() + " does not accept value or has " +
    "already been set");
 }
 if (! option.getChoices().isEmpty()  && ! option.getChoices().contains(value)) {
  throw new InvalidValueException(option, value);
 }
 List<String> list = optionValues.get(option);
 if (list == null) {
  list = new ArrayList<>();
  optionValues.put(option, list);
 }
 list.add(value);
 return this;
}
origin: spring-projects/spring-framework

@Test
public void replaceUriTemplateParamsTemplateWithParamMatchNamePreEncoding() throws JspException {
  List<Param> params = new LinkedList<>();
  Set<String> usedParams = new HashSet<>();
  Param param = new Param();
  param.setName("n me");
  param.setValue("value");
  params.add(param);
  String uri = tag.replaceUriTemplateParams("url/{n me}", params, usedParams);
  assertEquals("url/value", uri);
  assertEquals(1, usedParams.size());
  assertTrue(usedParams.contains("n me"));
}
origin: google/guava

static char[] randomChars(Random rand, int size) {
 Set<Character> chars = new HashSet<>(size);
 for (int i = 0; i < size; i++) {
  char c;
  while (true) {
   c = (char) rand.nextInt(Character.MAX_VALUE - Character.MIN_VALUE + 1);
   if (!chars.contains(c)) {
    break;
   }
  }
  chars.add(c);
 }
 char[] retValue = new char[chars.size()];
 int i = 0;
 for (char c : chars) {
  retValue[i++] = c;
 }
 Arrays.sort(retValue);
 return retValue;
}
origin: stanfordnlp/CoreNLP

private static <T, S> void exploreStates(List<DFSAState<T, S>> toVisit, Set<DFSAState<T, S>> visited) {
 while (!toVisit.isEmpty()) {
  DFSAState<T, S> state = toVisit.get(toVisit.size() - 1);
  toVisit.remove(toVisit.size() - 1);
  if (!visited.contains(state)) {
   toVisit.addAll(state.successorStates());
   visited.add(state);
  }
 }
}
origin: thinkaurelius/titan

private void verifyVerticesRetrieval(long[] vids, List<TitanVertex> vs) {
  assertEquals(vids.length, vs.size());
  Set<Long> vset = new HashSet<>(vs.size());
  vs.forEach(v -> vset.add((Long) v.id()));
  for (int i = 0; i < vids.length; i++) {
    assertTrue(vset.contains(vids[i]));
  }
}
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: google/guava

private static Set<Feature<?>> computeValuesCollectionFeatures(Set<Feature<?>> mapFeatures) {
 Set<Feature<?>> valuesCollectionFeatures = computeCommonDerivedCollectionFeatures(mapFeatures);
 if (mapFeatures.contains(MapFeature.ALLOWS_NULL_VALUE_QUERIES)) {
  valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_QUERIES);
 }
 if (mapFeatures.contains(MapFeature.ALLOWS_NULL_VALUES)) {
  valuesCollectionFeatures.add(CollectionFeature.ALLOWS_NULL_VALUES);
 }
 return valuesCollectionFeatures;
}
java.utilSetcontains

Javadoc

Searches this set for the specified object.

Popular methods of Set

  • add
    Adds the specified element to this set if it is not already present (optional operation). More forma
  • 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
  • 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