To convert an ArrayList<Integer> to int[]:
- Acheck_circle
Loop and copy each element
- B
list.toIntArray()
- C
Cast to int[]
- D
list.toArray()
Explanation
Generic toArray returns Integer[]; need manual loop for int[].
AP Computer Science A· difficulty 4/5
To convert an ArrayList<Integer> to int[]:
Loop and copy each element
list.toIntArray()
Cast to int[]
list.toArray()
Explanation
Generic toArray returns Integer[]; need manual loop for int[].
Want 10 more like this — adaptive to your weak spots?