Java 8 Streams Java Java API
java.util.stream.DoubleStream
DoubleStream map(DoubleUnaryOperator mapper)
This intermediate operation, returns a stream consisting of the results of applying the given mapper function to the elements of this stream.
package com.logicbig.example.doublestream;import java.util.stream.DoubleStream;public class MapExample { public static void main(String... args) { DoubleStream ds = DoubleStream.of(1.0, 1.2, 2.0, 2.4, 3.0); DoubleStream ds2 = ds.filter(d -> d > 2) .map(d -> d + 2.5); ds2.forEach(System.out::println); }}
4.95.5