Objective
Search for data by using methods, such as findFirst(), findAny(), anyMatch(), allMatch(), and noneMatch()
-
You can retrieve the first or any element from the collection.
src/org/j6toj8/collections/datasearch/DataSearch_FindFirstAny.javalink:../../../src/org/j6toj8/collections/datasearch/DataSearch_FindFirstAny.java[role=include]
console outputFirst: 1 Any: 9
-
You can check whether or not collection elements meet any criteria.
src/org/j6toj8/collections/datasearch/DataSearch_Match.javalink:../../../src/org/j6toj8/collections/datasearch/DataSearch_Match.java[role=include]
console outputanyMatch: true allMatch: false noneMatch: false
References
-
Using Streams
Boyarsky, Jeanne; Selikoff, Scott. OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide (p. 185). Wiley. Kindle Edition.