LongStream count() in Java with examples
LongStream count() returns the count of elements in the stream. LongStream count() is present in java.util.stream.LongStream
Example 1 : Count the elements in LongStream.
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.
Example 2 : Count the elements in a given range.
Example 3 : Count distinct elements in LongStream.