Java 8 Streams Java Java API
java.util.stream.DoubleStream
<U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper)
This intermediate operation returns an object-valued Stream consisting of the results of applying the given mapper function to the elements of this stream.
Stream
package com.logicbig.example.doublestream;import java.math.BigDecimal;import java.util.stream.DoubleStream;import java.util.stream.Stream;public class MapToObjExample { public static void main(String... args) { DoubleStream ds = DoubleStream.of(1.0, 1.2, 2.0, 2.4, 3.0); Stream<BigDecimal> stream = ds.mapToObj(BigDecimal::valueOf); stream.map(bd -> bd.multiply(BigDecimal.TEN)) .forEach(System.out::println); }}
10.012.020.024.030.0