Why is there no Stream.flatMap () function?

Why is there no function Stream.flatMap()

(without any parameters) to align a Stream<Stream<T>>

?

It will simply be implemented as Stream.flatMap(o -> o)

.

In my opinion, this is by far the most common use of flatMap (Function Mapper) .

+3


source to share


1 answer


I would guess because it is trivial to use



import static java.util.function.Function.identity;
...  
streamOfStreams.flatMap(identity())

      

+3


source







All Articles