PermutationGroup { public List<Permutation> all() { final List<Permutation> permutations = new ArrayList<Permutation>(); Backtracker counter = new Backtracker() { @Override public void applyTo(Permutation p) { permutations.add(p); } @Override public boolean isFinished() { return false; } }; this.apply(counter); return permutations; } PermutationGroup(int size);  PermutationGroup(Permutation base);  PermutationGroup(int size, List<Permutation> generators); static PermutationGroup makeSymN(int size); int getSize(); long order(); Permutation get(int uIndex, int uSubIndex); List<Permutation> getLeftTransversal(int index); List<Permutation> transversal(final PermutationGroup subgroup); void apply(Backtracker backtracker); List<Permutation> all(); void changeBase(Permutation newBase); void enter(Permutation g); int test(Permutation permutation); @Override String toString();  }
@Test public void allTest() { int size = 4; PermutationGroup group = PermutationGroup.makeSymN(size); List<Permutation> all = group.all(); Assert.assertEquals(factorial(size), all.size()); }