permutations

trait Collection[A] {
  def permutations: Iterator[Collection[A]]
}

permutations computes all the possible permutations of this collection and returns an Iterator to iterate them.