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 Array of ArrayLists Possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Array of ArrayLists Possible?" Watch "Array of ArrayLists Possible?" New topic

Array of ArrayLists Possible?

Jonathan Night

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:

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

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:
subject: Array of ArrayLists Possible?
It's not a secret anymore!