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

How to use
removeIf
method
in
java.util.Set

Best Java code snippets using java.util.Set.removeIf (Showing top 20 results out of 3,339)

origin: apache/flink

@Override
public void notifyCheckpointComplete(long completedCheckpointId) {
  synchronized (materializedSstFiles) {
    if (completedCheckpointId > lastCompletedCheckpointId) {
      materializedSstFiles.keySet().removeIf(checkpointId -> checkpointId < completedCheckpointId);
      lastCompletedCheckpointId = completedCheckpointId;
    }
  }
}
origin: spring-projects/spring-framework

/**
 * Clear the merged bean definition cache, removing entries for beans
 * which are not considered eligible for full metadata caching yet.
 * <p>Typically triggered after changes to the original bean definitions,
 * e.g. after applying a {@code BeanFactoryPostProcessor}. Note that metadata
 * for beans which have already been created at this point will be kept around.
 * @since 4.2
 */
public void clearMetadataCache() {
  this.mergedBeanDefinitions.keySet().removeIf(bean -> !isBeanEligibleForMetadataCaching(bean));
}
origin: spring-projects/spring-framework

void purgeExpiredRegistries() {
  long now = System.currentTimeMillis();
  this.remoteRegistries.entrySet().removeIf(entry -> entry.getValue().isExpired(now));
}
origin: spring-projects/spring-framework

/**
 * Clear the introspection cache for the given ClassLoader, removing the
 * introspection results for all classes underneath that ClassLoader, and
 * removing the ClassLoader (and its children) from the acceptance list.
 * @param classLoader the ClassLoader to clear the cache for
 */
public static void clearClassLoader(@Nullable ClassLoader classLoader) {
  acceptedClassLoaders.removeIf(registeredLoader ->
      isUnderneathClassLoader(registeredLoader, classLoader));
  strongClassCache.keySet().removeIf(beanClass ->
      isUnderneathClassLoader(beanClass.getClassLoader(), classLoader));
  softClassCache.keySet().removeIf(beanClass ->
      isUnderneathClassLoader(beanClass.getClassLoader(), classLoader));
}
origin: AsyncHttpClient/async-http-client

@Override
public boolean remove(Predicate<Cookie> predicate) {
 return cookieJar.entrySet().removeIf(v -> predicate.test(v.getValue().cookie));
}
origin: apache/kafka

synchronized void retainTopics(Collection<String> topics) {
  metadataByPartition.entrySet().removeIf(entry -> !topics.contains(entry.getKey().topic()));
  unauthorizedTopics.retainAll(topics);
  invalidTopics.retainAll(topics);
  computeClusterView();
}
origin: ben-manes/caffeine

/**
 * Deregisters a cache entry listener based on the supplied configuration.
 *
 * @param configuration the listener's configuration.
 */
public void deregister(CacheEntryListenerConfiguration<K, V> configuration) {
 requireNonNull(configuration);
 dispatchQueues.keySet().removeIf(registration ->
   configuration.equals(registration.getConfiguration()));
}
origin: stanfordnlp/CoreNLP

/**
 * Removes all keys whose count is 0. After incrementing and decrementing
 * counts or adding and subtracting Counters, there may be keys left whose
 * count is 0, though normally this is undesirable. This method cleans up
 * the map.
 * <p>
 * Maybe in the future we should try to do this more on-the-fly, though it's
 * not clear whether a distinction should be made between "never seen" (i.e.
 * null count) and "seen with 0 count". Certainly there's no distinction in
 * getCount() but there is in containsKey().
 */
public void removeZeroCounts() {
 map.keySet().removeIf(e -> getCount(e) == 0);
}
origin: org.springframework/spring-beans

/**
 * Clear the merged bean definition cache, removing entries for beans
 * which are not considered eligible for full metadata caching yet.
 * <p>Typically triggered after changes to the original bean definitions,
 * e.g. after applying a {@code BeanFactoryPostProcessor}. Note that metadata
 * for beans which have already been created at this point will be kept around.
 * @since 4.2
 */
public void clearMetadataCache() {
  this.mergedBeanDefinitions.keySet().removeIf(bean -> !isBeanEligibleForMetadataCaching(bean));
}
origin: apache/incubator-druid

@Override
public void close(String namespace)
{
 if (config.isEvictOnClose()) {
  cache.asMap().keySet().removeIf(key -> key.namespace.equals(namespace));
 }
}
origin: neo4j/neo4j

private void cleanupMonitorListeners( Object monitorListener, Method key )
{
  methodMonitorListeners.computeIfPresent( key, ( method1, handlers ) ->
  {
    handlers.removeIf( handler -> monitorListener.equals( handler.getMonitorListener() ) );
    return handlers.isEmpty() ? null : handlers;
  } );
}
origin: neo4j/neo4j

private void markSeen( Class<? extends AnyValue> typeToCheck, Set<Class<? extends AnyValue>> seen )
{
  seen.removeIf( t -> t.isAssignableFrom( typeToCheck ) );
}
origin: spring-projects/spring-framework

result.removeIf(expression -> !expression.match(contentType));
return (!result.isEmpty() ? new ConsumesRequestCondition(result) : null);
origin: spring-projects/spring-framework

/**
 * Checks if any of the contained media type expressions match the given
 * request 'Content-Type' header and returns an instance that is guaranteed
 * to contain matching expressions only. The match is performed via
 * {@link MediaType#includes(MediaType)}.
 * @param exchange the current exchange
 * @return the same instance if the condition contains no expressions;
 * or a new condition with matching expressions only;
 * or {@code null} if no expressions match.
 */
@Override
public ConsumesRequestCondition getMatchingCondition(ServerWebExchange exchange) {
  if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
    return PRE_FLIGHT_MATCH;
  }
  if (isEmpty()) {
    return this;
  }
  Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>(this.expressions);
  result.removeIf(expression -> !expression.match(exchange));
  return (!result.isEmpty() ? new ConsumesRequestCondition(result) : null);
}
origin: neo4j/neo4j

private static boolean fileContains( File file, String... expectedStrings ) throws IOException
{
  Set<String> expectedStringSet = asSet( expectedStrings );
  try ( Stream<String> lines = Files.lines( file.toPath() ) )
  {
    lines.forEach( line -> expectedStringSet.removeIf( line::contains ) );
  }
  return expectedStringSet.isEmpty();
}
origin: prestodb/presto

@Override
public synchronized void dropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData)
{
  partitions.entrySet().removeIf(entry ->
      entry.getKey().matches(databaseName, tableName) && entry.getValue().getValues().equals(parts));
}
origin: ben-manes/caffeine

@CacheSpec
@CheckNoStats
@Test(dataProvider = "caches")
public void entrySet_removeIf(Map<Integer, Integer> map, CacheContext context) {
 Predicate<Entry<Integer, Integer>> isEven = entry -> (entry.getValue() % 2) == 0;
 boolean hasEven = map.entrySet().stream().anyMatch(isEven);
 boolean removedIfEven = map.entrySet().removeIf(isEven);
 assertThat(map.entrySet().stream().anyMatch(isEven), is(false));
 assertThat(removedIfEven, is(hasEven));
 if (removedIfEven) {
  assertThat(map.size(), is(lessThan(context.original().size())));
 }
}
origin: ben-manes/caffeine

@CacheSpec
@CheckNoStats
@Test(dataProvider = "caches", expectedExceptions = NullPointerException.class)
public void entrySet_removeIf_null(Map<Integer, Integer> map, CacheContext context) {
 map.entrySet().removeIf(null);
}
origin: google/guava

public void testRemoveIfWithConcurrentRemoval() {
 LocalCache<Integer, Integer> map =
   makeLocalCache(createCacheBuilder().concurrencyLevel(1).initialCapacity(1));
 map.put(0, 1);
 map.put(1, 1);
 map.put(2, 1);
 map.entrySet()
   .removeIf(
     entry -> {
      assertThat(entry.getValue()).isNotNull();
      map.remove((entry.getKey() + 1) % 3);
      return false;
     });
 assertEquals(1, map.size());
}
origin: google/guava

public void testRemoveIfWithConcurrentModification() {
 LocalCache<Integer, Integer> map =
   makeLocalCache(createCacheBuilder().concurrencyLevel(1).initialCapacity(1));
 map.put(1, 1);
 map.put(2, 1);
 map.put(3, 1);
 map.entrySet()
   .removeIf(
     entry -> {
      if (entry.getValue().equals(1)) {
       map.put(entry.getKey(), 2);
       return true;
      } else {
       return false;
      }
     });
 assertEquals(3, map.size());
 assertFalse(map.containsValue(1));
}
java.utilSetremoveIf

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
  • removeAll
    Removes from this set all of its elements that are contained in the specified collection (optional o
  • forEach
  • removeAll,
  • forEach,
  • equals,
  • containsAll,
  • retainAll,
  • hashCode,
  • parallelStream,
  • spliterator,
  • of

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • setContentView (Activity)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • String (java.lang)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • 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