Java 8 Streams Java Java API
Interface:
java.util.stream.IntStream
Method:
long count()
This method returns the count of elements in this stream. This is a special case of a reduction and is equivalent to: mapToLong(e > 1L).sum()
This is a terminal operation.
Examples
package com.logicbig.example.intstream;
import java.util.stream.IntStream;
public class CountExample {
public static void main(String... args) { IntStream a = IntStream.range(1, 100); long c = a.count(); System.out.println(c); } }
Output99
|