I'm able to easily achieve this in Scala with something like:
def permute(xs: List[Int], ys: List[Int]) = {
for {x <- xs; y <- ys} yield (x,y)
}
So if I give it {1, 2}, {3, 4} I return {1, 3}, {1, 4}, {2, 3}, {2, 4}
I was hoping to be able to translate this to java 8 using streams.
I'm having a bit of difficulty and I'd like to be able to extend this out farther as I'd like to be able to generate many permuted test samples from more than two lists.
Will it inevitably be a nested mess even using streams or am I not applying myself enough?
Some additional answers were found after realizing that I was looking for a cartesian product:
How can I make Cartesian product with Java 8 streams?