LongStream sequential() in Java
LongStream sequential() returns a sequential LongStream. It may return itself, either because the stream was already sequential, or because the underlying stream state was modified to be sequential. LongStream sequential() is an intermediate operation. Intermediate operations are invoked on a Stream instance and after they finish their processing, they give a Stream instance as output.
LongStream sequential() Where, LongStream is a sequence of primitive long-valued element.
Example 1 :
3 5 9 12 14
Example 2 :
-2 -1 0 1 2 3
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. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.