LongStream count()
returns the count of elements in this stream.
count
has the following syntax.
long count()
The following example shows how to use count
.
import java.util.stream.LongStream; /*w ww. j a va 2s .c o m*/ public class Main { public static void main(String[] args) { LongStream b = LongStream.of(1L, 2L, Long.MAX_VALUE, Long.MIN_VALUE); long o = b.count(); System.out.println(o); } }
The code above generates the following result.