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

Method retainAll

corpus/java/training/guava/collect/Iterables.java:155–160  ·  view source on GitHub ↗

Removes, from an iterable, every element that does not belong to the provided collection. This method calls Collection#retainAll if iterable is a collection, and Iterators#retainAll otherwise. @param removeFrom the iterable to (potentially) remove elements from @param el

(Iterable<?> removeFrom, Collection<?> elementsToRetain)

Source from the content-addressed store, hash-verified

153 * @return {@code true} if any element was removed from {@code iterable}
154 */
155 @CanIgnoreReturnValue
156 public static boolean retainAll(Iterable<?> removeFrom, Collection<?> elementsToRetain) {
157 return (removeFrom instanceof Collection)
158 ? ((Collection<?>) removeFrom).retainAll(checkNotNull(elementsToRetain))
159 : Iterators.retainAll(removeFrom.iterator(), elementsToRetain);
160 }
161
162 /**
163 * Removes, from an iterable, every element that satisfies the provided

Callers

nothing calls this directly

Calls 4

retainAllMethod · 0.95
retainAllMethod · 0.65
iteratorMethod · 0.65
checkNotNullMethod · 0.45

Tested by

no test coverage detected