Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6243459

(coll) Multidimension ArrayList: ArrayList like object supporting multi dimensions

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: