We will certainly hear from Stuart on this very soon. Meanwhile, I have to say
that the situation you've described is not that clear-cut in my opinion.

I understand there might be a discrepancy between how the `modCount` field is
described and how it is actually used.

Incrementing `modCount` unconditionally makes more sense to me. The whole
purpose of this mechanism is to fail fast, exposing possible bugs in the client
code. I believe it should be incremented on an attempt to modify the collection,
rather than on the effective result of that attempt.

It's somewhat similar to the following question: should Collections.emptyList
(or Collections.emptySet) throw an exception on an attempt to call `clear` (or
`remove(e)` where `e` is not a member of the said collection)?

-Pavel


Reply via email to