3 ms·
How about: Iterator<String> it = names.iterator(); while (it.hasNext()) { if (it.next().startsWith("B")) { it.remove(); } }
by elFarto 11y ago
How about:
Iterator<String> it = names.iterator();
while (it.hasNext())
{
if (it.next().startsWith("B"))
{
it.remove();
}
}
- newgame 11y agoYes, much better. For anyone interested, here's a link with background information: http://stackoverflow.com/questions/1196586/calling-remove-in-foreach-loop-in-java http://stackoverflow.com/questions/1196586/calling-remove-in...