Collection.removeIf

Removes all of the elements of this collection that satisfy the given predicate. Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller.

@implSpec The default implementation traverses all elements of the collection using its {@link #iterator}. Each matching element is removed using {@link Iterator#remove()}. If the collection's iterator does not support removal then an {@code UnsupportedOperationException} will be thrown on the first matching element.

@param filter a predicate which returns {@code true} for elements to be removed @return {@code true} if any elements were removed @throws NullPointerException if the specified filter is null @throws UnsupportedOperationException if elements cannot be removed from this collection. Implementations may throw this exception if a matching element cannot be removed or if, in general, removal is not supported.

interface Collection(E)
bool
removeIf
(
Predicate!E filter
)

Meta