Returns a
Collection of all the permutations of the specified
Iterable.
Notes: This is an implementation of the algorithm for
Lexicographical Permutations Generation, described in Knuth's "The Art of
Computer Programming", Volume 4, Chapter 7, Section 7.2.1.2. The
iteration order follows the lexicographical order. This means that
the first permutation will be in ascending order, and the last will be in
descending order.
Duplicate elements are considered equal. For example, the list [1, 1]
will have only one permutation, instead of two. This is why the elements
have to implement
Comparable.
An empty iterable has only one permutation, which is an empty list.
This method is equivalent to
Collections2.orderedPermutations(list, Ordering.natural()).