Well, if you combine the two together...
List<Foo> foos;
for (fooIndex = 0; fooIndex < foos.length; ++fooIndex) {
Foo foo = foos[fooIndex];
List<Bar> bars = foo.bars;
for (barIndex = 0; barIndex < bars.length; ++barIndex) {
Bar bar = bars[barIndex];
}
}
It would be immediately, visibly obvious if you accidently use `fooIndex` in the `bars` list. Good luck getting that with `i` and `j`.That, of course, is assuming you even need the indexes. Otherwise you get this:
foreach (Foo foo in foos) {
foreach (Bar bar in foo.bars) {
}
}