Stream factory methods

The Streams API provides numerous ways to get a Stream instance. The following is the list of ways to create Streams that we are covering:

  • Stream Builder
  • Stream.empty()
  • Stream.of()
  • Stream.generate()
  • Stream.iterate()
  • Kotlin extension—asStream()

Among the preceding list, we've already seen how the Kotlin extension—asStream and the Stream.iterate function works (it'll work in the same way as the DoubleStream.iterate value, covered in the previous example). We will have a look at the rest.

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

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