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 Java API includes other methods to create Stream objects. In this section, we enumerate some of them:

  • The Files class provides more methods that create streams:
    • find(): This method returns the files contained in a folder, or in any of its subfolders, which meet the criteria specified in a lambda expression.
    • walk(): This method returns a stream of Path objects with the contents of a folder and all its subfolders.
  • The Stream class also includes other static methods that allow you to create streams:
    • iterate(): This method produces a stream whose elements are generated by the application of a unary function to an initial element. The first element of the stream is the initial element, the second element, the result of ...

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