Java Utililty Methods Permute

List of utility methods to do Permute

Description

The list of methods to do Permute are organized into topic(s).

Method

ArrayList>permutationBuilder(ArrayList curList, int next)
permutation Builder
ArrayList<ArrayList<Integer>> listOfNewPerm = new ArrayList<ArrayList<Integer>>();
for (int i = 0; i <= curList.size(); i++) {
    ArrayList<Integer> k = new ArrayList<Integer>(curList);
    k.add(i, next);
    listOfNewPerm.add(k);
return listOfNewPerm;
ArrayList>permutationBuilder2(ArrayList> inputArray, int k)
permutation Builder
ArrayList<ArrayList<Integer>> listOfAllPerm = new ArrayList<ArrayList<Integer>>();
for (int i = 0; i < inputArray.size(); i++) {
    ArrayList<ArrayList<Integer>> listOfNewPerm = permutationBuilder(inputArray.get(i), k);
    for (int j = 0; j < listOfNewPerm.size(); j++) {
        listOfAllPerm.add(listOfNewPerm.get(j));
return listOfAllPerm;
...
Listpermute(Iterable files, Random rand)
permute
List<File> r = new ArrayList<>();
for (File file : files) {
    int i = rand.nextInt(r.size() + 1);
    if (i == r.size()) {
        r.add(file);
    } else {
        r.add(r.get(i));
        r.set(i, file);
...