i am looking for a data structure to store two dimensional integer arrays.
Is List the rigth data structure or should i use another one?
Can someone give me a short example on how to create such a data structure and how to add a 2d array?
Edit: I want a data structure in which i want to store int[11][7] arrays.
For instance ten, int[11][7] arrays.
If you need to store a number of
int[][]arrays in a data structure, I would probably recommend that you store theint[][]arrays in anObjectthat represents what the data contains, then store theseObjectsin anArrayList.For example, here is a simple
Objectwrapper for yourint[][]arraysAnd here is how you would use them, and store them in an
ArrayListThe reason for my suggestion is that your
int[][]array must have some meaning to you. By storing this in anObjectwrapper class, you can give it a meaning. For example, if the values were co-ordinates, you would call your classCoordinatesinstead of2DArray. You, therefore, create aListofCoordinates, which has a lot more meaning thanint[][][].