/** * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when * filtering a filtered map. */ private static <K, V> Map<K, V> filterFiltered(AbstractFilteredMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) { return new FilteredEntryMap<K, V>(map.unfiltered, Predicates.<Entry<K, V>>and(map.predicate, entryPredicate)); }
/** * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when * filtering a filtered map. */ private static <K, V> Map<K, V> filterFiltered(AbstractFilteredMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) { return new FilteredEntryMap<K, V>(map.unfiltered, Predicates.<Entry<K, V>>and(map.predicate, entryPredicate)); }
FilteredCollection<E> createCombined(Predicate<? super E> newPredicate) { return new FilteredCollection<E>(unfiltered, Predicates.<E>and(predicate, newPredicate)); // .<E> above needed to compile in JDK 5 }
FilteredCollection<E> createCombined(Predicate<? super E> newPredicate) { return new FilteredCollection<E>(unfiltered, Predicates.<E>and(predicate, newPredicate)); // .<E> above needed to compile in JDK 5 }
FilteredCollection<E> createCombined(Predicate<? super E> newPredicate) { return new FilteredCollection<E>(unfiltered, Predicates.<E>and(predicate, newPredicate)); // .<E> above needed to compile in JDK 5 }
@Override public boolean removeAll(Collection<?> c) { return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(in(c)))); }
/** * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when * filtering a filtered navigable map. */ @GwtIncompatible("NavigableMap") private static <K, V> NavigableMap<K, V> filterFiltered( FilteredEntryNavigableMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) { Predicate<Entry<K, V>> predicate = Predicates.and(map.entryPredicate, entryPredicate); return new FilteredEntryNavigableMap<K, V>(map.unfiltered, predicate); }
@Override public boolean removeAll(Collection<?> c) { return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(in(c)))); }
/** * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when * filtering a filtered sorted map. */ private static <K, V> SortedMap<K, V> filterFiltered( FilteredEntrySortedMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) { Predicate<Entry<K, V>> predicate = Predicates.and(map.predicate, entryPredicate); return new FilteredEntrySortedMap<K, V>(map.sortedMap(), predicate); }
/** * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when * filtering a filtered navigable map. */ @GwtIncompatible("NavigableMap") private static <K, V> NavigableMap<K, V> filterFiltered( FilteredEntryNavigableMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) { Predicate<Entry<K, V>> predicate = Predicates.and(map.entryPredicate, entryPredicate); return new FilteredEntryNavigableMap<K, V>(map.unfiltered, predicate); }
/** * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when * filtering a filtered map. */ private static <K, V> BiMap<K, V> filterFiltered( FilteredEntryBiMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) { Predicate<Entry<K, V>> predicate = Predicates.and(map.predicate, entryPredicate); return new FilteredEntryBiMap<K, V>(map.unfiltered(), predicate); }
/** * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when * filtering a filtered sorted map. */ private static <K, V> SortedMap<K, V> filterFiltered( FilteredEntrySortedMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) { Predicate<Entry<K, V>> predicate = Predicates.and(map.predicate, entryPredicate); return new FilteredEntrySortedMap<K, V>(map.sortedMap(), predicate); }
@Override public boolean removeAll(Collection<?> c) { return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(in(c)))); }
@Override public boolean remove(Object o) { return Iterables.removeFirstMatching(unfiltered.entrySet(), Predicates.<Entry<K, V>>and(predicate, Maps.<V>valuePredicateOnEntries(equalTo(o)))) != null; }
@Override public boolean remove(Object o) { return Iterables.removeFirstMatching(unfiltered.entrySet(), Predicates.<Entry<K, V>>and(predicate, Maps.<V>valuePredicateOnEntries(equalTo(o)))) != null; }
@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 removeAll(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.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))))); }