Create Object Collection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ron

    #1

    Create Object Collection

    Hi,
    I currently have a jagged array as such.
    int[][] myJArray = new [21][];

    In my constructor i initialize the array of arrays like
    such.

    for(int i=0; i<21; i++)
    {
    myJArray[i] = new int[16];
    }

    Thses arrays will always be the same items.

    Would it be better to have something like the following

    x=0 to 20 and myItem[x] the collection of items.

    myObjectCollect ion[x].myItem1
    myObjectCollect ion[x].myItem2
    myObjectCollect ion[x].myItem3
    myObjectCollect ion[x].myItem4
    myObjectCollect ion[x].myItem5
    myObjectCollect ion[x].myItem6

    How would i create the object collection?

    Thanks Ron
Working...