I hope this is the place to ask about JOOL. Appologies if not.
I need to be able to combine multiple streams in a combinatorial manner.
e.g. I have n streams (n would normally be 2 or 3) and I want to generate a single stream that contains every combination of elements in each of those streams.
Looking at JOOL it seems that Seq.duplicate() and Seq.intersperse() may be useful in handling this, but I'm not sure how to go about this.
Essentially I'm looking for something that looks a bit like this:
Stream<Tuple> combine(Stream... streams)
Just to be clear, if I had 2 streams, A and B that had these values:
A: X,Y,Z
B: 6,7,8
I would get a single stream that contains:
(X,6), (X,7), (X,8), (Y,6), (Y,7), (Y,8), (Z,6), (Z,7), (Z,8)
Note: the streams do not need to be the same size, you just get A * B (or A *B * C ...) elements in the resulting stream.
Many thanks for any advice on this.
Tim