Learn Java Programming - ArrayList removeIf Method Tutorial

Publié le: 07 novembre 2015
sur la chaîne: Daniel Ross
2,352
20

The removeIf method removes all matching elements in the current ArrayList instance that evaluate to true for the Predicate expression filter (say what??? - I'll explain). In order to use this method, you will need to have a basic understanding of lambda expressions. If you are not familiar with lambda expressions, the following tutorials will teach you what you need to know in order to use this method:

Lambda Expressions Introduction
Lambda Block Body
Lambda and Generic Funtional Interface

The Predicate interface is a functional interface that has a single abstract method named test that returns a primitive boolean result.
public interface Predicate chevron T chevron {
boolean test(T t);
}
So basically we can pass a Predicate based lambda expression as the argument for this method to do its thing. I'll demonstrate exactly how the Predicate interface works in the source code.


Sur cette page du site, vous pouvez voir la vidéo en ligne Learn Java Programming - ArrayList removeIf Method Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Daniel Ross 07 novembre 2015, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 2,352 fois et il a aimé 20 téléspectateurs. Bon visionnage!