hey guys. OK so, I've been wondering this for a while now. my code is always so unnecessarily cluttered because I don't know how to do this, lol.
say I have a set of private class variables:
private ArrayList row0 = new ArrayList<String>();
private ArrayList row1 = new ArrayList<String>();
// etc. all the way to 7 in this case
Now i have a loop where i want to assign (for example), 8 periods or something to each array list as separate elements. I don't want to do this same code and repeat it 8 times for each list, like this:
for (int i = 0; i < 7; i++) {
row0.add(".");
row1.add(".");
// etc.
}
instead I would like to be able do something like this....
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 7; j++) {
rowi.add(".");
}
}
how do I substitute that "i" in there though?