aspose file tools
The moose likes Beginning Java and the fly likes Array of ArrayLists Possible? 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 "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)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Array of ArrayLists Possible?
 
Similar Threads
arrays of ArrayList confusion
comparing and sorting arraylist of arraylist
Understanding Multi-dimension Arrays
Buttons...
How can I manually add values to ArrayList[]