I am trying to make a catalog for a shop. For that I have a 2D array:
String childElements[][] = new String[][];
I want to add data into this array. The data is another array:
ArrayList<String> names = new ArrayList<String>();
names can vary depending on the input that I get.
For example if it is a furniture store, the categories will be Tables, Chairs etc.
I have my categories stored in another array which is something like:
String groupElements[] = {"Tables", "Chairs"};
And names contains: {"Wood", "Metal", "4-seater", "6-seater"}
So, I want the childElements array to reflect it like:
childElements = ["Chairs"]["Wood", "Metal"]
["Tables"]["4-seater"]["6-seater"]
So how do I insert the data to serve my needs?
I would like to stick with an array of arrays and not go for list or a hashmap as the architecture depends on that.
String childElements = new String[][];is not a valid syntax