I’ve heard of using a two dimensional array like this :
String[][] strArr;
But is there any way of doing this with a list?
Maybe something like this?
ArrayList<String><String> strList;
And using something like this to add to it?
strList.add("hey", "hey");
Any way of doing something like this? Any help appreciated.
It would be good if there is because i am currently putting strings into two differrent ArrayList’s in pairs.
You would use
And then when you needed to add a new “row”, you’d add the list:
I’ve used this mostly when I wanted to hold references to several lists of Point in a GUI so I could draw multiple curves. It works well.
For example: