-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
x86
-
windows_2000
A DESCRIPTION OF THE REQUEST :
ArrayList is a 1-dimensional array. To have dynamic (i.e. resizable) multidimensional arrays, a class "MultiArrayList" would be handy:
MultiArrayList mal = new MultiArrayList(2); //2 = 2 dimensions
mal.set(value1, 0, 0); //set value1 at [0,0]
As 1.5 supports varargs, the same API can be used for n-Dimensions:
MultiArrayList mal = new MultiArrayList(3); //3 = 3 dimensions
mal.set(value1, 3, 1, 7); //set value1 at [3,1,7]
Object o = mal.get(3, 1, 7); //get cell value
JUSTIFICATION :
So far, multidimensional arrays can be created via fixed arrays (e.g. new Object[][][]). But these arrays can't grow/shrink dynamically.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ArrayList like object that supports multi dimensions.
ACTUAL -
ArrayList only supports 1 dimension (i.e. basically a List).
CUSTOMER SUBMITTED WORKAROUND :
Use standard arrays and put quite some effort to resize them via System.arraycopy(), etc.
###@###.### 2005-03-21 12:11:56 GMT
ArrayList is a 1-dimensional array. To have dynamic (i.e. resizable) multidimensional arrays, a class "MultiArrayList" would be handy:
MultiArrayList mal = new MultiArrayList(2); //2 = 2 dimensions
mal.set(value1, 0, 0); //set value1 at [0,0]
As 1.5 supports varargs, the same API can be used for n-Dimensions:
MultiArrayList mal = new MultiArrayList(3); //3 = 3 dimensions
mal.set(value1, 3, 1, 7); //set value1 at [3,1,7]
Object o = mal.get(3, 1, 7); //get cell value
JUSTIFICATION :
So far, multidimensional arrays can be created via fixed arrays (e.g. new Object[][][]). But these arrays can't grow/shrink dynamically.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ArrayList like object that supports multi dimensions.
ACTUAL -
ArrayList only supports 1 dimension (i.e. basically a List).
CUSTOMER SUBMITTED WORKAROUND :
Use standard arrays and put quite some effort to resize them via System.arraycopy(), etc.
###@###.### 2005-03-21 12:11:56 GMT