Im trying to add string values inside a 2D list. Was able to add the 1st layer using this:
List<List<String>> twodaray = new ArrayList<List<String>>();
List<String> x = new ArrayList<String>();
for ( int i = 0, m = 1; i < attribteList.size(); i = i+2, m = m+2) {
String attributeName = attribteList.get(i);
x.add(attributeName);
}
twodaray.add(x);
for(List<String> ls : twodaray) {
System.out.println(Arrays.deepToString(ls.toArray()));
}
Was wondering how can I access the inner layer of the ArrayList like print it out (sysout) or even adding values to it? Something like this.
for(List<String> ls : twodaray) {
System.out.println(Arrays.deepToString(ls.toArray()));
for(List<List<String>> ls2d : ls) {
if (ls = something) {
ls2d.add(something);
}
}
}
Kinda new to using this 2 dimensional list and any help is greatly appreciated. ty...