(Collection<E> unfiltered, Predicate<? super E> predicate)
| 88 | |
| 89 | |
| 90 | public static <E> Collection<E> filter(Collection<E> unfiltered, Predicate<? super E> predicate) { |
| 91 | if (unfiltered instanceof FilteredCollection) { |
| 92 | // Support clear(), removeAll(), and retainAll() when filtering a filtered |
| 93 | // collection. |
| 94 | return ((FilteredCollection<E>) unfiltered).createCombined(predicate); |
| 95 | } |
| 96 | return new FilteredCollection<E>(checkNotNull(unfiltered), checkNotNull(predicate)); |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Delegates to {@link Collection#contains}. Returns {@code false} if the |
no test coverage detected