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

There's more...

The stream class also has other two methods that can be used to filter the elements of a stream:

  • dropWhile(): This method receives a Predicate expression as the parameter. It has a different behavior with ordered and unordered streams. With ordered streams, the method deletes the first elements that match the predicate from the stream. It deletes elements when the elements match the predicate. When it finds an element that doesn't match the predicate, it stops deleting the elements and returns the rest of the stream. With unordered streams, its behavior is not deterministic. It deletes a subset of elements that match the predicate but is not specified what subset of elements it will delete. As with the other methods, it may ...

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