Java 8 Streams Java Java API
java.util.stream.IntStream
DoubleStream mapToDouble(IntToDoubleFunction mapper)
This intermediate operation returns a DoubleStream consisting of the results of applying the given mapper function to the elements of this stream.
DoubleStream
package com.logicbig.example.intstream;import java.util.stream.DoubleStream;import java.util.stream.IntStream;public class MapToDoubleExample { public static void main(String... args) { IntStream intStream = IntStream.range(1, 5); DoubleStream doubleStream = intStream.mapToDouble(i -> i / 2d); doubleStream.forEach(System.out::println); }}
0.51.01.52.0