Example usage for java.util.stream DoubleStream mapToObj

List of usage examples for java.util.stream DoubleStream mapToObj

Introduction

In this page you can find the example usage for java.util.stream DoubleStream mapToObj.

Prototype

<U> Stream<U> mapToObj(DoubleFunction<? extends U> mapper);

Source Link

Document

Returns an object-valued Stream consisting of the results of applying the given function to the elements of this stream.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleStream b = DoubleStream.of(1.1, 2.2, 3.3, 4.4, 5.5);
    b.mapToObj(n -> {
        return n * n + "";
    }).forEach(System.out::println);
}

From source file:ch.zweivelo.renderer.simple.math.LinearSolverTest.java

@Test
public void testSolveLinear() throws Exception {
    DoubleStream solutions = LINEAR.solve(2d, 1d);
    assertNotNull(solutions);// www . j a  va 2  s  . c  o m
    List<Double> solutionsList = solutions.mapToObj(d -> d).collect(toList());
    assertEquals(1l, solutionsList.size());
    assertEquals(solutionsList.get(0), -2d, EPSILON);
}