So I have an Integer[][] data that I want to convert into an ArrayList<ArrayList<Integer>>, so I tried using streams and came up with the following line:
ArrayList<ArrayList<Integer>> col = Arrays.stream(data).map(i -> Arrays.stream(i).collect(Collectors.toList())).collect(Collectors.toCollection(ArrayList<ArrayList<Integer>>::new));
But the last part collect(Collectors.toCollection(ArrayList<ArrayList<Integer>>::new)) gives me an error that it cannot convert ArrayList<ArrayList<Integer>> to C.
Listimplementation, you can doList<List<Integer>> col = Arrays.stream(data).map(Arrays::asList).collect(Collectors.toList());