LongStream generate(LongSupplier s) returns an infinite sequential unordered stream where each element is generated by the provided LongSupplier(a supplier of long-valued results). This is suitable for generating constant streams, streams of random elements, etc.
static LongStream generate(LongSupplier s)
- LongStream : a sequence of primitive long-valued elements.
- LongSupplier : a supplier of long-valued elements.
- s : LongSupplier for generated elements.
Return Value : a new infinite sequential unordered LongStream.
Example 1 :
4377 6200 9920 6015 7879 7887 8792
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.