Move the iterator declaration to here. You are declaring an iterator, then
trying to modify the container. Once you have your iterator, any changes to
the underlying container could trigger a ConcurrentModificationException.
From the Sun's java documentation:
"This field (modCount) is used by the iterator and list iterator
implementation returned by the iterator and listIterator methods. If the
value of this field changes unexpectedly, the iterator (or list iterator)
will throw a ConcurrentModificationException in response to the next, remove,
previous, set or add operations. This provides fail-fast behavior, rather
than non-deterministic behavior in the face of concurrent modification during
iteration."