/** * Traverses an iterator and removes every element that does not belong to the * provided collection. The iterator will be left exhausted: its * {@code hasNext()} method will return {@code false}. * * @param removeFrom the iterator to (potentially) remove elements from * @param elementsToRetain the elements to retain * @return {@code true} if any element was removed from {@code iterator} */ public static boolean retainAll( Iterator<?> removeFrom, Collection<?> elementsToRetain) { return removeIf(removeFrom, not(in(elementsToRetain))); }
/** * Traverses an iterator and removes every element that does not belong to the * provided collection. The iterator will be left exhausted: its * {@code hasNext()} method will return {@code false}. * * @param removeFrom the iterator to (potentially) remove elements from * @param elementsToRetain the elements to retain * @return {@code true} if any element was removed from {@code iterator} */ public static boolean retainAll( Iterator<?> removeFrom, Collection<?> elementsToRetain) { return removeIf(removeFrom, not(in(elementsToRetain))); }
/** * Traverses an iterator and removes every element that does not belong to the * provided collection. The iterator will be left exhausted: its * {@code hasNext()} method will return {@code false}. * * @param removeFrom the iterator to (potentially) remove elements from * @param elementsToRetain the elements to retain * @return {@code true} if any element was removed from {@code iterator} */ public static boolean retainAll( Iterator<?> removeFrom, Collection<?> elementsToRetain) { return removeIf(removeFrom, not(in(elementsToRetain))); }
/** * Traverses an iterator and removes every element that does not belong to the * provided collection. The iterator will be left exhausted: its * {@code hasNext()} method will return {@code false}. * * @param removeFrom the iterator to (potentially) remove elements from * @param elementsToRetain the elements to retain * @return {@code true} if any element was removed from {@code iterator} */ public static boolean retainAll( Iterator<?> removeFrom, Collection<?> elementsToRetain) { return removeIf(removeFrom, not(in(elementsToRetain))); }
@Override public boolean retainAll(Collection<?> collection) { return removeIf(not(in(collection))); }
@Override public boolean retainAll(Collection<?> collection) { return removeIf(not(in(collection))); }
@Override public boolean retainAll(Collection<?> collection) { return removeIf(not(in(collection))); }
@Override public boolean retainAll(Collection<?> collection) { return removeIf(not(in(collection))); }
@Override public boolean retainAll(Collection<?> c) { return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and( entryPredicate, Maps.<K>keyPredicateOnEntries(not(in(c))))); } };
@Override public boolean retainAll(Collection<?> c) { return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and( entryPredicate, Maps.<K>keyPredicateOnEntries(not(in(c))))); } };
@Override public boolean retainAll(Collection<?> c) { return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and( entryPredicate, Maps.<K>keyPredicateOnEntries(not(in(c))))); } };
@Override public boolean retainAll(Collection<?> c) { return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and( entryPredicate, Maps.<K>keyPredicateOnEntries(not(in(c))))); } };
@Override public boolean retainAll(final Collection<?> collection) { return Iterables.removeIf(unfiltered, and(predicate, not(in(collection)))); }
@Override public boolean retainAll(final Collection<?> collection) { return Iterables.removeIf(unfiltered, and(predicate, not(in(collection)))); }
@Override public boolean retainAll(final Collection<?> collection) { return Iterables.removeIf(unfiltered, and(predicate, not(in(collection)))); }
@Override public boolean retainAll(final Collection<?> collection) { return Iterables.removeIf(unfiltered, and(predicate, not(in(collection)))); }
@Override public boolean retainAll(Collection<?> c) { return Iterables.removeIf(multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and(multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c))))); }
@Override public boolean retainAll(Collection<?> c) { return Iterables.removeIf(multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and(multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c))))); }
@Override public boolean retainAll(Collection<?> c) { return Iterables.removeIf(multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and(multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c))))); }
@Override public boolean retainAll(Collection<?> c) { return Iterables.removeIf(multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and(multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c))))); }