Java Permute permutationBuilder(ArrayList curList, int next)

Here you can find the source of permutationBuilder(ArrayList curList, int next)

Description

permutation Builder

License

Open Source License

Declaration

public static ArrayList<ArrayList<Integer>> permutationBuilder(ArrayList<Integer> curList, int next) 

Method Source Code


//package com.java2s;
//License from project: MIT License 

import java.util.ArrayList;

public class Main {
    public static ArrayList<ArrayList<Integer>> permutationBuilder(ArrayList<Integer> curList, int next) {
        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);/*  w w w . ja va2s . c  o  m*/
            listOfNewPerm.add(k);
        }
        return listOfNewPerm;
    }
}

Related

  1. permutationBuilder2(ArrayList> inputArray, int k)
  2. permute(Iterable files, Random rand)