Bug in ArrayList iterator

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 7 12:13:27 UTC 2015


On 07/01/2015 11:25, Doug Lea wrote:
> 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?
One attempt that I recall is JDK-4902078, I think it's come up several 
others times since then too.

-Alan



More information about the core-libs-dev mailing list