File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes An ArrayList of Arraylist of... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "An ArrayList of Arraylist of..." Watch "An ArrayList of Arraylist of..." New topic

An ArrayList of Arraylist of...

Micah Pezdirtz

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: 2398
I would change mainbox to this.

Micah Pezdirtz

Joined: Aug 14, 2006
Posts: 25
so, that would actually work??? it looks funny, i didnt really expect that to be real
I agree. Here's the link:
subject: An ArrayList of Arraylist of...
It's not a secret anymore!