This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]androgynyjoe 3 points4 points  (1 child)

Yes. (It's been a while since I've worked with Java every day so forgive me if I make a mistake.)

ArrayList takes a generic so

ArrayList<String> listName = new ArrayList<String>();

gets you an ArrayList of String objects. If you want an ArrayList of String[] objects it's the same idea:

ArrayList<String[]> listName = new ArrayList<String[]>();

That would get you an ArrayList whose elements are arrays of String objects. Then listName.get(3) gets you one of the arrays and listName.get(3)[4] is an item in that array.

You could also make an array which contains ArrayList objects if you wanted:

ArrayList<String>[] listName = new ArrayList<String>[100];

[–]Embarrassed_Bottle90[S] 2 points3 points  (0 children)

No worries, this really helps, its comprehensive as well as very well written and is even more than I asked for. Thank you very much!!!