DoubleStream generate(DoubleSupplier s) returns an infinite sequential unordered stream where each element is generated by the provided DoubleSupplier(a supplier of double-valued results). This is suitable for generating constant streams, streams of random elements, etc.
static DoubleStream generate(DoubleSupplier s)
- DoubleStream : a sequence of primitive double-valued elements.
- DoubleSupplier : a supplier of double-valued elements.
- s : DoubleSupplier for generated elements.
Return Value : a new infinite sequential unordered DoubleStream.
Example 1 : To generate stream of random doubles.
2428.4470875214092 1339.9762523410686 302.44560518440267 9004.604086737152 3627.071411231598 2865.762726856176 4029.711939243109
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.