removeIf() Method in Collection Interface Java 8

On the Collection Interface we have new removeIf() method. This removeIf method takes an Predicate Functional Interface, Predicates takes an Object and returns a boolean. So off course object the Predicate will have as a parameter is an object from the collection and if the Predicate returns true than this element will be just removed.

So in our case all the tournaments will be removed, which names are strictly greater than 10.


So in our output we see French Open, Australian Open has been removed and others has been kept.

Leave a Reply

Your email address will not be published. Required fields are marked *