permutations function

Iterable<List> permutations (List list, [ Comparator comparator ])

Returns an iterable over the lexographic permutations of list using the optional comparator.

Implementation

Iterable<List> permutations(List list, [Comparator comparator]) {
  return new _PermutationIterable(list, comparator != null
      ? comparator : Comparable.compare);
}