Bug in ArrayList iterator

Doug Lea dl at cs.oswego.edu
Wed Jan 7 11:25:26 UTC 2015


On 01/07/2015 04:45 AM, Remi Forax wrote:
> A simple Java question, what this code does ?
>
>    ArrayList<String> list = new ArrayList<>();
>    list.add("foo");
>    list.add("bar");
>    for(String s: list) {
>      list.remove(s);
>    }
>

I have a vague recollection that this issue has come up before,
and that nothing was done about it because it broke compatibility
with some existing code. Maybe someone with records of past CCC
decisions could check this?

-Doug




More information about the core-libs-dev mailing list