MultiDim Array & Scope

I want to build a method which will return a multidimensional array which I can use to populate an SWT Tree. I cannot initialize the array till I get to the Option loop and as a result my array cannot be seen outside that level.

Get all ProductTypes

For Each ProductType

Get all Product

For Each Product

Get all Options

I want to get here

Array[ProductType][Product][Options]

Thanks for the assist

Rgds

Message was edited by:

Popick

[508 byte] By [Popicka] at [2007-10-2 21:22:21]
# 1
All you need is three nested for loops. What exactly the problem that you are having?
LRMKa at 2007-7-14 0:32:37 > top of Java-index,Java Essentials,New To Java...
# 2

Thanks

While I think this bit of code initializes the array a3 progressively. How do I insert the relevant values?

int[][][] a3 = new int[rand.nextInt(7)][][];

for(int i = 0; i < a3.length; i++) {

a3[i] = new int[rand.nextInt(5)][];

for(int j = 0; j < a3[i].length; j++){

a3[i][j] = new int[rand.nextInt(5)];

}

}

}

The neurons are not firing

Popicka at 2007-7-14 0:32:37 > top of Java-index,Java Essentials,New To Java...