Cartesian product of arbitrary sets in Java

后端 未结 9 2205
小鲜肉
小鲜肉 2020-11-22 07:28

Do you know some neat Java libaries that allow you to make cartesian product of two (or more) sets?

For example: I have three sets. One with objects of class Person

9条回答
  •  滥情空心
    2020-11-22 07:35

    The number of sets might vary so I cannot do this in nested foreach loop.

    Two hints:

    • A x B x C = A x (B x C)
    • Recursion

提交回复
热议问题