code: public Permutation toPermutation() {
          Permutation p = new Permutation(this.size());
          for (int i = 0; i < this.size(); i++) {
              p.set(i, this.cells.get(i).first());
          }
          return p;
      }
docs: Converts the whole partition into a permutation.
  
  @return the partition as a permutation