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 ...