Example usage for java.util.stream DoubleStream mapToLong

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

Introduction

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

Prototype

LongStream mapToLong(DoubleToLongFunction mapper);

Source Link

Document

Returns a LongStream 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.mapToLong(n -> {
        return (long) (n * n);
    }).forEach(System.out::println);
}