Streams of Primitives

suggest change

Java provides specialized Streams for three primitive types: IntStream (for ints), LongStream (for longs) and DoubleStream (for doubles). Besides being optimized implementations for their respective primitives, they also provide several specific terminal methods, typically for mathematical operations. E.g.:

IntStream is = IntStream.of(10, 20, 30);
double average = is.average().getAsDouble(); // average is 20.0

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents