So i'm creating a method that looks like this:
public static ArrayList<int[]> permuteArray(int[] array)
I have a helper method that looks like this:
public static List<List<Integer>> permuteArray(List<List<Integer>> list, List<Integer> result, int [] arr) {
if(result.size() == arr.length){
list.add(new ArrayList<>(result));
}
else{
for(int i = 0; i < arr.length; i++){
if(result.contains(arr[i]))
{
continue;
}
result.add(arr[i]);
permuteArray(list, result, arr);
result.remove(result.size() - 1);
}
}
return list;
}
I have this line : List<List<Integer>> permute = permuteArray(list, new ArrayList<>(), array);
But i want to convert the List<List<Integer>> to ArrayList<int[]>. Is this possible for the helper method to return ArrayList<int[]> or if the original method can?
ArrayList<int[]>instead ofList<List<Integer>>? It probably can. It would be easier to answer if you included the code of that method.ArrayListspecifically?