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

Method removeIf

corpus/java/training/guava/collect/Iterators.java:238–249  ·  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

236 * @since 2.0
237 */
238 @CanIgnoreReturnValue
239 public static <T> boolean removeIf(Iterator<T> removeFrom, Predicate<? super T> predicate) {
240 checkNotNull(predicate);
241 boolean modified = false;
242 while (removeFrom.hasNext()) {
243 if (predicate.apply(removeFrom.next())) {
244 removeFrom.remove();
245 modified = true;
246 }
247 }
248 return modified;
249 }
250
251 /**
252 * 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