I am looking for a library for java that will generate all possible order permutations of a set. The only library I can find is combinatoricslib on google code. I find it very hard to believe this is the only java library that does this, and am quite frankly very surprised by this.
Is there anything in the JDK, or apache commons math, or another library, that provides this same functionality?
I am happy to use combinatoricslib, I just can't believe that's the only option, other than writing the algorithm myself, which admittedly is not that difficult, but neither is .isBlankOrNull(), and apache commons includes that.
There's the PermutationIterator class in the Apache Commons Collection library version 4. It accepts a generic Collection and provides an Iterator that iterates over all permutations of the elements in the Collection (each call to next() on the Iterator provides an ordered List).
I just realised version 4 of the Collection library was only released on 2013-11-27. Version 3 doesn't provide a utility for permutations. V4 "represents a major revamp of collections by supporting new language features introduced with Java 1.5, mainly support for generics."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With