Example usage for java.util.stream DoubleStream flatMap

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

Introduction

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

Prototype

DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper);

Source Link

Document

Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element.

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.flatMap(n -> DoubleStream.of(n * n)).forEach(System.out::println);
}