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

Method removeIf

output/java_guava/1.4.16/Iterators.java:247–258  ·  view source on GitHub ↗

Removes every element that satisfies the provided predicate from the iterator. The iterator will be left exhausted: its hasNext() method will return false. @param removeFrom the iterator to (potentially) remove elements from @param predicate a predicate that determines whether an el

(Iterator<T> removeFrom, Predicate<? super T> predicate)

Source from the content-addressed store, hash-verified

245 */
246
247 @CanIgnoreReturnValue
248 public static <T> boolean removeIf(Iterator<T> removeFrom, Predicate<? super T> predicate) {
249 checkNotNull(predicate);
250 boolean modified = false;
251 while (removeFrom.hasNext()) {
252 if (predicate.apply(removeFrom.next())) {
253 removeFrom.remove();
254 modified = true;
255 }
256 }
257 return modified;
258 }
259
260 /**
261 * Traverses an iterator and removes every element that does not belong to the

Callers 5

removeAllMethod · 0.95
retainAllMethod · 0.95
removeIfMethod · 0.95
removeAllMethod · 0.95
retainAllMethod · 0.95

Calls 5

applyMethod · 0.65
nextMethod · 0.65
removeMethod · 0.65
checkNotNullMethod · 0.45
hasNextMethod · 0.45

Tested by

no test coverage detected