© Ralph Lecessi 2019
Ralph LecessiFunctional Interfaces in Javahttps://doi.org/10.1007/978-1-4842-4278-0_9

9. Use in Collections

Ralph Lecessi1 
(1)
Kendall Park, NJ, USA
 

Functional interfaces can be used to perform several important operations on collections.

Section 9.1: Removing Elements from a Collection

The removeIf method can be used to remove elements from a Collection object whose Iterator supports the remove operation.
default boolean removeIf(Predicate<? super E> filter);
If the predicate supplied to the removeIf method is true for an element of the collection, that element is removed from the collection. If the Collection object’s Iterator does not support the remove operation, an UnsupportedOperationException will be thrown. In the following ...

Get Functional Interfaces in Java: Fundamentals and Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.