The Stream.flatMap() operation transforms a stream of
Stream.flatMap()
a, b, c
into a stream that contains zero or more elements for each input el
IntStream.range(0, 10) .mapToObj(n -> IntStream.of(n, n / 2, n / 3)) .reduce(IntStream.empty(), IntStream::concat) .forEach(System.out::println);
As you see elements are mapped to Streams too, and then concatenated into one large stream.