Originally posted by Mike Simmons:
Well, your modifications may (quite possibly) result in a CME. It's not guaranteed. Throwing a CME is not a general property of collections - it' s a property of several specific commonly-used collection classes, such as ArrayList, LinkedList, HashSet, and a few others. Even for those, it's never guaranteed that CME will be thrown. But probably it will. So the advice here is sound - it's just expressed a little more strongly than it should be, in my opinion.
I know CME are not guaranteed, the JavaDoc of almost every class in the JCF states this, but you're going to have this sort of trouble in practice. Even though a CME might not be thrown in some circumstances, in would be a concurrecnt modification to alternate a Collection in an enhanced for-lopp running over that very Collection, if resulting in a CME or not ...
[ July 22, 2008: Message edited by: Guido Sautter ]