MCPcopy Create free account
hub / github.com/antlr/codebuff / filter

Method filter

output/java_guava/1.4.18/Iterators.java:643–658  ·  view source on GitHub ↗

Returns a view of unfiltered containing all elements that satisfy the input predicate retainIfTrue.

(final Iterator<T> unfiltered, final Predicate<? super T> retainIfTrue)

Source from the content-addressed store, hash-verified

641
642
643 public static <T> UnmodifiableIterator<T> filter(final Iterator<T> unfiltered, final Predicate<? super T> retainIfTrue) {
644 checkNotNull(unfiltered);
645 checkNotNull(retainIfTrue);
646 return new AbstractIterator<T>() {
647 @Override
648 protected T computeNext() {
649 while (unfiltered.hasNext()) {
650 T element = unfiltered.next();
651 if (retainIfTrue.apply(element)) {
652 return element;
653 }
654 }
655 return endOfData();
656 }
657 };
658 }
659
660 /**
661 * Returns a view of {@code unfiltered} containing all elements that are of

Callers 11

entryIteratorMethod · 0.95
iteratorMethod · 0.95
frequencyMethod · 0.95
findMethod · 0.95
tryFindMethod · 0.95
iteratorMethod · 0.95
iteratorMethod · 0.95
iteratorMethod · 0.95
iteratorMethod · 0.95
descendingIteratorMethod · 0.95

Calls 2

checkNotNullMethod · 0.45
instanceOfMethod · 0.45

Tested by

no test coverage detected