It allows the internals of the list to know if there has been a structural modification made that might cause the current operation to give incorrect results.
If you've ever gotten ConcurrentModificationException
due to modifying a list (say, removing an item) while iterating it, its internal modCount
was what tipped off the iterator.
The AbstractList docs give a good detailed description.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…