Example usage for java.util.stream DoubleStream map

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

Introduction

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

Prototype

DoubleStream map(DoubleUnaryOperator mapper);

Source Link

Document

Returns a 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.map(n -> n * n).forEach(System.out::println);
}

From source file:de.tynne.benchmarksuite.Main.java

private static double standardDeviationOf(DoubleStream doubleStream, double average) {
    double sum = doubleStream.map(x -> Math.pow(x - average, 2.)).average().getAsDouble();
    return Math.sqrt(sum);
}

From source file:org.bonej.ops.ellipsoid.EllipsoidPoints.java

/**
 * Calculates the μ-factor of a point.
 *
 * @param v a point on a unit sphere surface.
 * @return inverse ratio of ellipsoid surface area around given point.
 *//*w  w w .  ja v a2  s .c  o m*/
private double mu(final Vector3d v) {
    final DoubleStream terms = DoubleStream.of(a * c * v.y, a * b * v.z, b * c * v.x);
    final double sqSum = terms.map(x -> x * x).sum();
    return Math.sqrt(sqSum);
}