September 2019
Intermediate to advanced
816 pages
18h 47m
English
Besides using filter(), which allows us to filter elements of a stream by a predicate, we can find an element in a stream via anyFirst() and findFirst().
Let's assume that we have the following list wrapped in a stream:
List<String> melons = Arrays.asList( "Gac", "Cantaloupe", "Hemi", "Gac", "Gac", "Hemi", "Cantaloupe", "Horned", "Hemi", "Hemi");