casting does not work on nested list object type and returns empty lists (List<List<Integer>>)
问题 I'm doing some leetcode challenges related to backtracking, namely: https://leetcode.com/problems/permutations/ Where I need to return List<List<Integer>> as the type, however my List<List<Integer>> only gets populated correctly if I accept List<Integer> as my parameter and I cast it to ArrayList<Integer> while I add it in the main result. Code : List<List<Integer>> result = new ArrayList<>(); public List<List<Integer>> permute(int[] nums) { bt(new ArrayList<Integer>(), nums); return result;