|
Description
|
Several places in the documentation, for example,
the method description for LinkedList.listIterator,
specify that certain iterators have fail-fast
behavior, stating:
... [I]f the LinkedList is structurally modified
at any time after the Iterator is created, in any
way except through the ListIterator's own remove
or add methods, the Iterator will throw a Concurrent-
ModificationException. Thus, in the face of
concurrent modification, the Iterator fails quickly
and cleanly, rather than risking arbitrary, non-
deterministic behavior at an undetermined time in
the future.
Something is wrong or unclear in the first sentence.
If the list is modified in some way other that via
the iterator, how can the Iterator get control to
throw an exception?
If the iterator is not involved until the next
time an Iterator method is called, then the wording
erroneously implies that things fail as soon as
the list is modified (instead of the next time the
iterator is used after the list is modified).
If the iterator _is_ involved at the time of the
modification (e.g., if the LinkedList verifies
that no iterators are active), then it's not the
Iterator that fails by throwing an exception;
it's some method of the LinkedList.
Therefore, the wording is unclear or inaccurate.
DSB/DFI
(Review ID: 40380)
======================================================================
Posted Date : 2005-09-27 06:52:42.0
|