IntStream asLongStream() in Java
IntStream asLongStream() returns a LongStream consisting of the elements of this stream, converted to long. This 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 asLongStream() Where, LongStream is a sequence of primitive long-valued element.
Return Value : IntStream asLongStream() returns a LongStream consisting of the elements of this stream, converted to long.
Example 1 :
3 5 9 12 14
Example 2 :
3 4 5 6 7
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.