Fabio de Miranda Fabio de Miranda - 1 year ago 143
Python Question

Is there an equivalent of Python's itertools for Java?

I'm searching for a library (preferably generic) that generates iterable combinations and permutations of data contained in collections. Cartesian product would also be nice.

The best way of describing what I want would be "itertools for Java".

Answer Source

itertools does much more than just combinations and permutations, so (while it would surely be nice to have all of itertools when coding Java;-) you can get away with much less.

For example, for permutations, see here; for combinations, here (both classes are from the same author).