Edit: Thank you for all your prompt replies. Now I see the assignment won\'t work. From another thread I read that iterator in Java is much less powerful than iterator in C+
Since you seem to be using lists, the simplest solution in your case is to use two indexes, something like this:
for (int i = 0; i < aList.size(); i++) {
for (int j = i; j < aList.size(); j++) {
// do stuff with aList's elements
aList.get(j);
}
}
With iterators, you can achieve similar things, but you have to construct new iterators for the inner loop, possibly from
aList.subList(i, aList.size()).iterator();