Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Also, can I add an int into the 2nd ArrayList in the ArrayList containing int ArrayLists by doing for example:
lets say the ArrayList containing int ArrayLists is called holder, and I want to add the int value 10 into the 2nd (at index 1 of holder) int ArrayList in holder.

holder.get(1).add(10);

Is that correct?

What I have tried:

I can't find this on any of the first pages of google and I'm not sure if this can be done.
Posted
Updated 30-Mar-18 15:22pm
Comments
Richard MacCutchan 31-Mar-18 4:27am    
Why not try it and see what happens?

1 solution

ArrayList<Arraylist<Integer>> holder = new ArrayList<Arraaylist<Integer>>(10);


holder.get(1).add(10);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900