amaembo / streamex

Enhancing Java Stream API
Apache License 2.0
2.18k stars 249 forks source link

Feature request: flatMapToEntry(), but with mapper type to Stream instead of Map #231

Closed jasper-smit closed 4 years ago

jasper-smit commented 4 years ago

I want to do something like this

StreamEx.of(...)
.flatMapToEntry(element -> { .... })
.groupingTo(ArrayList::new)
}

However, because the mapper of flatMapToEntry has to deliver a Map i can only produce unique keys.

amaembo commented 4 years ago

Sorry, I don't understand. Can you provide an example input and the desired output?

Probably the cross() method will suit your needs?

jasper-smit commented 4 years ago

Yes, cross() looks indeed what i needed. Thanks for pointing me in the right direction.