Question: So I hoped to figure out the code that would finish this:

```
public List<List<Integer>> create4(List<Integer> dice) {
   //unknown code

        return listOf4s;
    }

```

So dice would always be a List of 5 Integers,

from the 5 Integers I would like to create a List every possible permutation using only 4 numbers.

I hope I have made this clear enough.

I have searched around but have not quite seen anything I could use. Any help would be great!

Answer: 
I have not tried this out, but hopefully this helps.

```
public List<List<Integer>> createN(List<Integer> dice) {
    if (dice.size() == 1) {
        List<List<Integer>> permutations = new ArrayList<List<Integer>>();
        permutations.add(dice);
        return permutations;
    }
    else {
       List<List<Integer>> permuations = new ArrayList<List<Integer>>();
       for (int i=0;i<dice.size();i++) {
           List<Integer> remainingElementsInPermutationSet = new ArrayList<Integer>();
           Integer firstElementInPermutationSet = null; 
           for (int j=0;j<dice.size();j++) {
               if (i==j) {
                  firstElementInPermutationSet = dice.get(j);
               }
               else {
                   remainingElementsInPermutationSet.add(dice.get(j));   
               }
           }
           List<List<Integer>> remainderPermutations = createN(remainingElementsInPermutationSet);
           for (List<Integer> permutationRemainer : remainderPermutations) {
               List<Integer> permutation = new ArrayList<Integer>();
               permutation.add(firstElementInPermutationSet);
               permutation.addAll(permutationRemainer);
               permuations.add(permutation);
           }
       }
       return permutations:
    }

} 

```
This is what I did using @btreat 's idea and it worked great.

```
public List<List<Integer>> create4(List<Integer> dice) {
        List<List<Integer>> permutations = new ArrayList<List<Integer>>();
        for(int i = 0; i < dice.size(); i++) {
            List<Integer> includedPermutation = new ArrayList<Integer>();
            for(int j = 0; j < dice.size(); j++) {
                if(i!=j) {
                    includedPermutation.add(dice.get(j));
                }
            }
            permutations.add(includedPermutation);
        }

        return permutations;
    }

```