code: public static <E> Collection<List<E>> permutations(Collection<E> elements) {
          return new PermutationCollection<E>(elements);
      }
docs: Note: copy from Google Guava under Apache License v2.
  <br />
  
  Returns a {@link Collection} of all the permutations of the specified
  {@link Collection}.
  
  <p><i>Notes:</i> This is an implementation of the Plain Changes algorithm
  for permutations generation, described in Knuth's "The Art of Computer
  Programming", Volume 4, Chapter 7, Section 7.2.1.2.
  
  <p>If the input list contains equal elements, some of the generated
  permutations will be equal.
  
  <p>An empty collection has only one permutation, which is an empty list.
  
  @param elements the original collection whose elements have to be permuted.
  @return an immutable {@link Collection} containing all the different
  permutations of the original collection.
  @throws NullPointerException if the specified collection is null or has any
  null elements.