Creating streams from different sources

In this recipe, you will learn how to create streams from different sources. You have different options, as the following:

  • The parallelStream() method of the Collection interface
  • The Supplier interface
  • A predefined set of elements
  • File and a directory
  • An array
  • A random number generator
  • The concatenation of two different streams

You can create a Stream object from other sources (that will be described in the There's more section), but we think that these are the more useful.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.118.90