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+
Do this:
ArrayList aList = new ArrayList();
// do something to fill the list
for (int i = 0; i < aList.size(); i++)
{
ArrayList bList = aList.subList(i, aList.size());
for (int j = 0; j < bList.size(); j++)
{
// do stuff with the sublist
}
}
It's important to note that bList is backed by aList so changes to bList will be reflected in aList...make non-structural changes only to keep your sanity.