I have this situation where it seems that the Java 8 Streams API would be helpful, but I\'m not fully sure how it could be.
From two Collections with distinct element ty
I hope I don't have any silly typos, but basically what you can do is :
List list = as
.stream()
.flatMap(a -> bs.stream().map (b -> new Pair(a,b)))
.collect (Collectors.toList());
Stream
from as
.a
instanceStream
of bs
b
to a pair of (a,b)