Click here to Skip to main content
14,029,616 members
Rate this:
 
Please Sign up or sign in to vote.
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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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


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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190419.4 | Last Updated 30 Mar 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100