Returns a view of unfiltered containing all elements that satisfy the input predicate retainIfTrue. The returned iterable's iterator does not support remove().
(
final Iterable<T> unfiltered, final Predicate<? super T> retainIfTrue)
| 613 | |
| 614 | |
| 615 | public static <T> Iterable<T> filter( |
| 616 | final Iterable<T> unfiltered, final Predicate<? super T> retainIfTrue) { |
| 617 | checkNotNull(unfiltered); |
| 618 | checkNotNull(retainIfTrue); |
| 619 | return new FluentIterable<T>() { |
| 620 | @Override |
| 621 | public Iterator<T> iterator() { |
| 622 | return Iterators.filter(unfiltered.iterator(), retainIfTrue); |
| 623 | } |
| 624 | }; |
| 625 | } |
| 626 | |
| 627 | /** |
| 628 | * Returns a view of {@code unfiltered} containing all elements that are of |
no test coverage detected