Bug in ArrayList iterator

Stanislav Baiduzhyi sbaiduzh at redhat.com
Wed Jan 7 10:57:13 UTC 2015


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. Throwing ConcurrentModification 
in hasNext() looks better in such case.

-- 
Regards,
    Stas




More information about the core-libs-dev mailing list