StoreDescriptor sd = copiedStoresListIterator.next(); fam = sd.getFamilyName().toByteArray(); if (famPredicate.apply(fam)) { copiedStoresListIterator.remove(); anyStoreRemoved = true;
@Override public boolean matches(char c) { return predicate.apply(c); }
@Override @SuppressWarnings("unchecked") public boolean containsKey(Object key) { return unfiltered.containsKey(key) && keyPredicate.apply((K) key); } }
@Override default boolean test(@Nullable T input) { return apply(input); } }
@Override public E last() { SortedSet<E> sortedUnfiltered = (SortedSet<E>) unfiltered; while (true) { E element = sortedUnfiltered.last(); if (predicate.apply(element)) { return element; } sortedUnfiltered = sortedUnfiltered.headSet(element); } } }
@Override public boolean apply(@Nullable T t) { // Avoid using the Iterator to avoid generating garbage (issue 820). for (int i = 0; i < components.size(); i++) { if (!components.get(i).apply(t)) { return false; } } return true; }
@Override public boolean apply(@Nullable T t) { // Avoid using the Iterator to avoid generating garbage (issue 820). for (int i = 0; i < components.size(); i++) { if (components.get(i).apply(t)) { return true; } } return false; }
boolean apply(@Nullable Object key, @Nullable V value) { // This method is called only when the key is in the map, implying that // key is a K. @SuppressWarnings("unchecked") K k = (K) key; return predicate.apply(Maps.immutableEntry(k, value)); }
@Override public boolean addAll(Collection<? extends E> collection) { for (E element : collection) { checkArgument(predicate.apply(element)); } return unfiltered.addAll(collection); }
@Override public boolean apply(Entry<V, K> input) { return forwardPredicate.apply(Maps.immutableEntry(input.getValue(), input.getKey())); } };
@Override public boolean removeIf(java.util.function.Predicate<? super E> filter) { checkNotNull(filter); return unfiltered.removeIf(element -> predicate.apply(element) && filter.test(element)); }
@Override protected T computeNext() { while (unfiltered.hasNext()) { T element = unfiltered.next(); if (retainIfTrue.apply(element)) { return element; } } return endOfData(); } };
@Override public boolean containsKey(@Nullable Object key) { if (unfiltered.containsKey(key)) { @SuppressWarnings("unchecked") // k is equal to a K, if not one itself K k = (K) key; return keyPredicate.apply(k); } return false; }
@SuppressWarnings("deprecation") // intentional; deprecation is for callers primarily @Override public boolean apply(Character character) { return predicate.apply(checkNotNull(character)); }
@Override public boolean add(E element) { checkArgument(predicate.apply(element)); return unfiltered.add(element); }
@Override public boolean contains(@Nullable Object element) { if (safeContains(unfiltered, element)) { @SuppressWarnings("unchecked") // element is in unfiltered, so it must be an E E e = (E) element; return predicate.apply(e); } return false; }
@Override public int count(@Nullable Object element) { int count = unfiltered.count(element); if (count > 0) { @SuppressWarnings("unchecked") // element is equal to an E E e = (E) element; return predicate.apply(e) ? count : 0; } return 0; }
@Override public int add(@Nullable E element, int occurrences) { checkArgument( predicate.apply(element), "Element %s does not match predicate %s", element, predicate); return unfiltered.add(element, occurrences); }
@Override public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) { unfiltered() .replaceAll( (key, value) -> predicate.apply(Maps.immutableEntry(key, value)) ? function.apply(key, value) : value); }
@Override public Collection<V> get(K key) { if (keyPredicate.apply(key)) { return unfiltered.get(key); } else if (unfiltered instanceof SetMultimap) { return new AddRejectingSet<K, V>(key); } else { return new AddRejectingList<K, V>(key); } }