aspose file tools*
The moose likes Beginning Java and the fly likes Array of ArrayLists Possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Array of ArrayLists Possible?" Watch "Array of ArrayLists Possible?" New topic
Author

Array of ArrayLists Possible?

Jonathan Night
Greenhorn

Joined: Jun 07, 2004
Posts: 5
I am trying to make an Array of ArrayLists...
Since I have 3 ArrayLists I want to make I thought it would be something like this...

ArrayList [] ReadyList = new ArrayList[3]();

So that I can make calls like this:

ReadyList[0].get(x);
or ReadyList[1].get(x);
or ReadyList[2].get(x);

If you're curious, the 3 arrays are supposed to represent events of priority 0, 1, and 2. If you know how I can do this I would really appreciate it. Thanks a bunch!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Jonathan Night
Greenhorn

Joined: Jun 07, 2004
Posts: 5
Thanks a bunch! Worked like a charm... Now I just gotta deal with Java.lang.StackOverflowError... Possibly the greater of the two evils...
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Better still, use List reference types:



Tony Morris
Java Q&A (FAQ, Trivia)
 
 
subject: Array of ArrayLists Possible?