jQuery in Action, 2nd edition
The moose likes Beginning Java and the fly likes An ArrayList of Arraylist of... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "An ArrayList of Arraylist of..." Watch "An ArrayList of Arraylist of..." New topic
Author

An ArrayList of Arraylist of...

Micah Pezdirtz
Greenhorn

Joined: Aug 14, 2006
Posts: 25
if i had:

ArrayList<ArrayList> mainBox;
ArrayList<Crayons> crayonBox1;
ArrayList<Crayons> crayonBox2;
ArrayList<Crayons> crayonBox3;

and then proceeded to add each crayonBox to the mainBox, would there be any loss of...whats it called i mean that the mainBox, being an ArrayList of ArrayLists, would be ok to hold ArrayLists<crayons>? i remember before i knew about AraryList<Object> i had to cast and recast things all the time, but would i have to do any of that in this case? i wasnt sure since the main box is ArrayList<ArrayList> and not ArrayList<ArrayList<crayons>> ??? if that kind of thing is existent or necessary. sorry if this is a lame question
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2341
I would change mainbox to this.

Micah Pezdirtz
Greenhorn

Joined: Aug 14, 2006
Posts: 25
so, that would actually work??? it looks funny, i didnt really expect that to be real
thanks!!!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: An ArrayList of Arraylist of...
 
Similar Threads
Generics Help
Display data using Structs Tag
How can I manually add values to ArrayList[]
List<ArrayList<String>> compile error
Compilers emits a warning when using ArrayList()