O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

In this recipe, we used three different methods to verify conditions over the elements of a Stream:

  • allMatch(): This method is a terminal operation that receives as parameter an implementation of the Predicate interface expressed as a lambda expression or as an object that implements it and returns a Boolean value. It returns true if the Predicate introduced is true for all the elements of the Stream and false otherwise.
  • anyMatch(): This method is a terminal operation that receives as parameter an implementation of the Predicate interface expressed as a lambda expression or as an object that implements it and returns a Boolean value. It returns true if the Predicate introduced is true for at least one of the elements of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required