Im looking for a way to construct a scale-able 2d list or something of the sort.
What i have so far is an array

int [][] mydata = new int[6][4];

The problem is in my editor i wont know how long to make the array as people are going to be able to add and remove elements. Naturally i tried to implement 2 lists but realized right away it was the same as a 2d array.

List<Integer> column = new ArrayList<Integer>();
List<Integer> row = new ArrayList<Integer>();

What data type should i use to implement a structure that allows me to add elements to it at run time without constructing and copying an entirely new array with its size + 1 every time an element is to be added?

I have seen examples of 2d lists and arraylists but they seem syntactically confusing and imo wouldnt lend themselves well to maintainability... so any help would be nice :)

4 Years
Discussion Span
Last Post by jwenting
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.