When removing inside foreach, do we need to step back
Posted
by Pentium10
on Stack Overflow
See other posts from Stack Overflow
or by Pentium10
Published on 2010-05-17T08:25:05Z
Indexed on
2010/05/17
8:30 UTC
Read the original article
Hit count: 306
Take this Java code:
for (ContactsReduced curContact : allcontacts) {
..........
allcontacts.remove(curContact);
}
I do based on a condition a remove, will the foreach miss the next item in order, and do we need to step back(somehow)?
© Stack Overflow or respective owner