Questions tagged [mapmulti]

MapMulti is a new Java StreamAPI method as of Java 16

3 questions
27
votes
2 answers

When and how to perform one to 0..n mapping Stream mapMulti over flatMap

I have been skimming through the news and the source code of the newest LTE Java 17 version and I have encountered with new Stream method called mapMulti. The early-access JavaDoc says it is similar to flatMap. Stream mapMulti(BiConsumer
Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
2
votes
1 answer

Java-Stream - mapMulti() with Infinite Streams

I thought that all stream pipelines written using flatMap() can be converted to use mapMulti. Looks like I was wrong when the flatMap() or mapMulti() returns/operates on an infinite stream. Note: this is for educational purpose only When we map an…
Thiyagu
  • 17,362
  • 5
  • 42
  • 79
0
votes
1 answer

Issues understanding mapMulti

I'm fairly when it comes to Java, and I've decided to dig a little into the implementations and uses of the API, especially the Stream API. I've made an implementation after thinking I got it right, and it worked. However I realized something that…
Paul
  • 314
  • 2
  • 13