If a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception——ConcurrentModificationException
"From the field of soft engineering, a Fail Fast Iterator is an Iterator that attempts to raise an error if the sequence of elements precessed by the Iterator is changed during Iteration"
所以你修改集合后Iterator只是被标记成fail-fast iterator,直到下次使用时才会抛出异常,因此会输出第二句话。 |