Is there a Java equivalent to Ruby's Array#product method, or a way of doing this:
groups = [
%w[hello goodbye],
%w[world everyone],
%w[here there]
]
combinations = groups.first.product(*groups.drop(1))
p combinations
# [
# ["hello", "world", "here"],
# ["hello", "world", "there"],
# ["hello", "everyone", "here"],
# ["hello", "everyone", "there"],
# ["goodbye", "world", "here"],
# ["goodbye", "world", "there"],
# ["goodbye", "everyone", "here"],
# etc.
This question is a Java version of this one: http://stackoverflow.com/questions/3419952/finding-the-product-of-a-variable-number-of-ruby-arrays