在这第一次使用我的迭代器时,一切都很顺利;
ListIterator<Client> it = people.listIterator();
while(it.hasNext()){
Client c = (Client)it.next();
System.out.println(c.getValeur());
}
System.out.println("Doing some operations on my values");
但是当我对我的价值观进行这些操作时
for (Client client : people) {
int i = client.getValeur();
i += 10000;
client.setValeur(i);
}
并使用相同的迭代器,我没有工作
while(it.hasNext()){
Client c = (Client) it.next();
System.out.println(c.getValeur());
}
我是否必须重新启动迭代器的索引?