Example usage for java.util.stream IntStream flatMap

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

Introduction

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

Prototype

IntStream flatMap(IntFunction<? extends IntStream> 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) {
    IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 3);
    IntStream i2 = i.flatMap(n -> IntStream.of(n * n));
    i2.forEach(System.out::println);

}