0

I have a stream of event e and I'd like to transform it into a stream of collection of 3 events :

e1--e2--e3--e4--e5--e6--e7--e8--e9--....eX

into

(e1,e2,e3)---(e4,e5,e6)---(e7,e8,e9)....

and then process this stream.

An important detail : I don't want to wait the end of the stream to build and process this new stream.

How would you do something like this ?

Tagir Valeev
  • 97,161
  • 19
  • 222
  • 334
user860302
  • 127
  • 1
  • 1
  • 3
  • Not sure that this is a duplicate of the linked quesiton. In the linked question it seems like the OP wants to split a Stream into a Stream of Streams of a given size "By partition I mean, divide a stream into sub-streams of a given size". Where as this question is more clearly asking whether a single stream can be split into a given number of Streams. Which would be two very different operations. I'm not sure this one can be done efficiently - without fully collecting the Stream, or building a Spliterator that knows the final Stream size. – John McClean Sep 19 '15 at 12:18
  • Then it’s possibly more like [this](http://stackoverflow.com/q/26463771/2711488) – Holger Sep 21 '15 at 09:39

0 Answers0