If I'm not mistaken LinkedList and Vector demonstrate exactly the same buggy behaviour.
-Pavel > On 7 Jan 2015, at 11:20, Chris Hegarty <chris.hega...@oracle.com> wrote: > > On 07/01/15 10:57, Stanislav Baiduzhyi wrote: >> On Wednesday 07 January 2015 10:56:01 Chris Hegarty wrote: >>> public boolean hasNext() { >>> - return cursor != size; >>> + return cursor != itrSize; >>> } >> >> If the user will invoke list.remove(E) to remove current or previous element >> then iterator will be skipping some elements. > > If this happens, then next() and/or remove() will throw CME. > > Throwing ConcurrentModification >> in hasNext() looks better in such case. > > It is not clear to me that users would be expecting CME from hasNext(), > whereas it is more next() and remove() is more obvious. > > -Chris. > >