Streams of Primitives
suggest changeJava 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents