I have below code
List<int[]> result = new ArrayList<int[]>();
result.add(new int[]{1,2});
result.add(new int[]{2,3});
int[][] re= result.toArray();
I tried to use toArray method to convert it to int[][]
data format. But, it will throw error,"incompatible types: Object[] cannot be converted to int[][]". Can someone explain the reason? and what I should do to convert it?
new int[][]
?List<List<Integer>>
would suit you better