Here you can find the source of permuteList(List list, int[] permutations)
@SuppressWarnings({ "rawtypes", "unchecked" }) public static void permuteList(List list, int[] permutations)
//package com.java2s; //License from project: MIT License import java.util.ArrayList; import java.util.List; public class Main { @SuppressWarnings({ "rawtypes", "unchecked" }) public static void permuteList(List list, int[] permutations) { if (permutations.length != list.size()) { throw new IllegalArgumentException("List length and permutation length are not equal"); }/*w ww . j a va 2s. c om*/ List<Object> tmpList = new ArrayList<Object>(permutations.length); for (int i = 0; i < permutations.length; i++) { tmpList.add(list.get(permutations[i])); } list.clear(); list.addAll(tmpList); } }