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

How to use
remove
method
in
java.util.Set

Best Java code snippets using java.util.Set.remove (Showing top 20 results out of 70,227)

Refine searchRefine arrow

  • Set.add
  • Set.isEmpty
  • Set.contains
  • Map.get
  • Set.size
  • Map.put
  • Map.remove
origin: google/guava

private static Set<Feature<?>> computeEntrySetFeatures(Set<Feature<?>> features) {
 Set<Feature<?>> derivedFeatures = new HashSet<>();
 derivedFeatures.addAll(features);
 derivedFeatures.remove(CollectionFeature.GENERAL_PURPOSE);
 derivedFeatures.remove(CollectionFeature.SUPPORTS_ADD);
 derivedFeatures.remove(CollectionFeature.ALLOWS_NULL_VALUES);
 derivedFeatures.add(CollectionFeature.REJECTS_DUPLICATES_AT_CREATION);
 if (!derivedFeatures.remove(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
  derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
 }
 return derivedFeatures;
}
origin: iluwatar/java-design-patterns

public synchronized void checkIn(T instance) {
 inUse.remove(instance);
 available.add(instance);
}
origin: apache/incubator-dubbo

public void removeListener(String key, ConfigurationListener configurationListener) {
  Set<ConfigurationListener> listeners = this.keyListeners.get(key);
  if (listeners != null) {
    listeners.remove(configurationListener);
  }
}
origin: prestodb/presto

  private void addOrReplaceExpressionCoercion(Expression expression, Type type, Type superType)
  {
    NodeRef<Expression> ref = NodeRef.of(expression);
    expressionCoercions.put(ref, superType);
    if (typeManager.isTypeOnlyCoercion(type, superType)) {
      typeOnlyCoercions.add(ref);
    }
    else if (typeOnlyCoercions.contains(ref)) {
      typeOnlyCoercions.remove(ref);
    }
  }
}
origin: spring-projects/spring-framework

/**
 * Remove the given prefix from this context.
 * @param prefix the prefix to be removed
 */
public void removeBinding(@Nullable String prefix) {
  if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
    this.defaultNamespaceUri = "";
  }
  else if (prefix != null) {
    String namespaceUri = this.prefixToNamespaceUri.remove(prefix);
    if (namespaceUri != null) {
      Set<String> prefixes = this.namespaceUriToPrefixes.get(namespaceUri);
      if (prefixes != null) {
        prefixes.remove(prefix);
        if (prefixes.isEmpty()) {
          this.namespaceUriToPrefixes.remove(namespaceUri);
        }
      }
    }
  }
}
origin: apache/hive

/**
 * connect adds an edge between a and b. Both nodes have
 * to be added prior to calling connect.
 * @param
 */
public void connect(BaseWork a, BaseWork b, SparkEdgeProperty edgeProp) {
 workGraph.get(a).add(b);
 invertedWorkGraph.get(b).add(a);
 roots.remove(b);
 leaves.remove(a);
 ImmutablePair<BaseWork, BaseWork> workPair = new ImmutablePair<BaseWork, BaseWork>(a, b);
 edgeProperties.put(workPair, edgeProp);
}
origin: gocd/gocd

@SuppressWarnings({"unchecked"})
public List<Modification> getModificationsForPipelineRange(final String pipelineName,
                              final Integer fromCounter,
                              final Integer toCounter) {
  return (List<Modification>) getHibernateTemplate().execute((HibernateCallback) session -> {
    final List<Long> fromInclusiveModificationList = fromInclusiveModificationsForPipelineRange(session, pipelineName, fromCounter, toCounter);
    final Set<Long> fromModifications = new TreeSet<>(fromInclusiveModificationsForPipelineRange(session, pipelineName, fromCounter, fromCounter));
    final Set<Long> fromExclusiveModificationList = new HashSet<>();
    for (Long modification : fromInclusiveModificationList) {
      if (fromModifications.contains(modification)) {
        fromModifications.remove(modification);
      } else {
        fromExclusiveModificationList.add(modification);
      }
    }
    SQLQuery query = session.createSQLQuery("SELECT * FROM modifications WHERE id IN (:ids) ORDER BY materialId ASC, id DESC");
    query.addEntity(Modification.class);
    query.setParameterList("ids", fromExclusiveModificationList.isEmpty() ? fromInclusiveModificationList : fromExclusiveModificationList);
    return query.list();
  });
}
origin: apache/storm

private void merge(Group g1, Group g2) {
  Group newGroup = new Group(g1, g2);
  currGroups.remove(g1);
  currGroups.remove(g2);
  currGroups.add(newGroup);
  for (Node n : newGroup.nodes) {
    groupIndex.put(n, newGroup);
  }
}
origin: google/guava

private static Set<Feature<?>> computeAsMapFeatures(Set<Feature<?>> multimapFeatures) {
 Set<Feature<?>> derivedFeatures = Helpers.copyToSet(multimapFeatures);
 derivedFeatures.remove(MapFeature.GENERAL_PURPOSE);
 derivedFeatures.remove(MapFeature.SUPPORTS_PUT);
 derivedFeatures.remove(MapFeature.ALLOWS_NULL_VALUES);
 derivedFeatures.add(MapFeature.ALLOWS_NULL_VALUE_QUERIES);
 derivedFeatures.add(MapFeature.REJECTS_DUPLICATES_AT_CREATION);
 if (!derivedFeatures.contains(CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS)) {
  derivedFeatures.remove(CollectionFeature.SERIALIZABLE);
 }
 return derivedFeatures;
}
origin: apache/incubator-druid

private void updateToLoadAndDrop(
  List<Notice> notices,
  Map<String, LookupExtractorFactoryContainer> lookupsToLoad,
  Set<String> lookupsToDrop
)
{
 for (Notice notice : notices) {
  if (notice instanceof LoadNotice) {
   LoadNotice loadNotice = (LoadNotice) notice;
   lookupsToLoad.put(loadNotice.lookupName, loadNotice.lookupExtractorFactoryContainer);
   lookupsToDrop.remove(loadNotice.lookupName);
  } else if (notice instanceof DropNotice) {
   DropNotice dropNotice = (DropNotice) notice;
   lookupsToDrop.add(dropNotice.lookupName);
   lookupsToLoad.remove(dropNotice.lookupName);
  } else {
   throw new ISE("Unknown Notice type [%s].", notice.getClass().getName());
  }
 }
}
origin: fesh0r/fernflower

private void buildDominatorTree() {
 VBStyleCollection<Integer, Integer> orderedIDoms = domEngine.getOrderedIDoms();
 List<Integer> lstKeys = orderedIDoms.getLstKeys();
 for (int index = lstKeys.size() - 1; index >= 0; index--) {
  Integer key = lstKeys.get(index);
  Integer idom = orderedIDoms.get(index);
  mapTreeBranches.computeIfAbsent(idom, k -> new HashSet<>()).add(key);
 }
 Integer firstid = statement.getFirst().id;
 mapTreeBranches.get(firstid).remove(firstid);
}
origin: iluwatar/java-design-patterns

/**
 * Checkout object from pool
 */
public synchronized T checkOut() {
 if (available.isEmpty()) {
  available.add(create());
 }
 T instance = available.iterator().next();
 available.remove(instance);
 inUse.add(instance);
 return instance;
}
origin: spring-projects/spring-framework

public static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) {
  Set methods = new HashSet();
  for (int i = 0; i < properties.length; i++) {
    PropertyDescriptor pd = properties[i];
    if (read) {
      methods.add(pd.getReadMethod());
    }
    if (write) {
      methods.add(pd.getWriteMethod());
    }
  }
  methods.remove(null);
  return (Method[]) methods.toArray(new Method[methods.size()]);
}
origin: apache/kafka

/**
 * After each partition is parsed, we update the current metric totals with the total bytes
 * and number of records parsed. After all partitions have reported, we write the metric.
 */
public void record(TopicPartition partition, int bytes, int records) {
  this.unrecordedPartitions.remove(partition);
  this.fetchMetrics.increment(bytes, records);
  // collect and aggregate per-topic metrics
  String topic = partition.topic();
  FetchMetrics topicFetchMetric = this.topicFetchMetrics.get(topic);
  if (topicFetchMetric == null) {
    topicFetchMetric = new FetchMetrics();
    this.topicFetchMetrics.put(topic, topicFetchMetric);
  }
  topicFetchMetric.increment(bytes, records);
  if (this.unrecordedPartitions.isEmpty()) {
    // once all expected partitions from the fetch have reported in, record the metrics
    this.sensors.bytesFetched.record(this.fetchMetrics.fetchBytes);
    this.sensors.recordsFetched.record(this.fetchMetrics.fetchRecords);
    // also record per-topic metrics
    for (Map.Entry<String, FetchMetrics> entry: this.topicFetchMetrics.entrySet()) {
      FetchMetrics metric = entry.getValue();
      this.sensors.recordTopicFetchMetrics(entry.getKey(), metric.fetchBytes, metric.fetchRecords);
    }
  }
}
origin: pxb1988/dex2jar

private void replacePhi(List<LabelStmt> phiLabels, Map<Local, Local> toReplace, Set<Value> set) {
  if (phiLabels != null) {
    for (LabelStmt labelStmt : phiLabels) {
      for (AssignStmt phi : labelStmt.phis) {
        Value[] ops = phi.getOp2().getOps();
        for (Value op : ops) {
          Value n = toReplace.get(op);
          if (n != null) {
            set.add(n);
          } else {
            set.add(op);
          }
        }
        set.remove(phi.getOp1());
        phi.getOp2().setOps(set.toArray(new Value[set.size()]));
        set.clear();
      }
    }
  }
}
origin: codingapi/tx-lcn

@Override
public void removeAttachments(String groupId, String unitId) {
  GroupCache groupCache = transactionInfoMap.get(groupId);
  if (Objects.isNull(groupCache)) {
    return;
  }
  groupCache.getUnits().remove(unitId);
  if (groupCache.getUnits().size() == 0) {
    transactionInfoMap.remove(groupId);
  }
}
origin: gocd/gocd

public void removePluginInterests(String pluginId) {
  for (String key : notificationNameToPluginsInterestedMap.keySet()) {
    if (notificationNameToPluginsInterestedMap.get(key).contains(pluginId)) {
      notificationNameToPluginsInterestedMap.get(key).remove(pluginId);
    }
  }
}
origin: ben-manes/caffeine

/**
 * KeySet.remove removes an element
 */
public void testRemove() {
  Set full = populatedSet(3);
  full.remove(one);
  assertFalse(full.contains(one));
  assertEquals(2, full.size());
}
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: spring-projects/spring-framework

/**
 * Callback after singleton creation.
 * <p>The default implementation marks the singleton as not in creation anymore.
 * @param beanName the name of the singleton that has been created
 * @see #isSingletonCurrentlyInCreation
 */
protected void afterSingletonCreation(String beanName) {
  if (!this.inCreationCheckExclusions.contains(beanName) && !this.singletonsCurrentlyInCreation.remove(beanName)) {
    throw new IllegalStateException("Singleton '" + beanName + "' isn't currently in creation");
  }
}
java.utilSetremove

Javadoc

Removes the specified object 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
    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
  • 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

  • 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
  • CodeWhisperer alternatives
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