Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: Odd ConcurrentModificationException Date: Tue, 10 Dec 2013 13:10:01 -0800 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 10 Dec 2013 21:09:54 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="aba33539224e5c782fe0c4053f7756fd"; logging-data="24527"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18QNl0BzrG+wXjMqQA5SBYD" User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 In-Reply-To: Cancel-Lock: sha1:/C4s89aMRZtCUkRhTDp68NCUXRk= Xref: csiph.com comp.lang.java.programmer:26831 On 12/10/2013 9:49 AM, Stefan Ram wrote: > Knute Johnson writes: >> I'm getting an odd ConcurrentModificationException in a MouseListener >> when I try to remove an element from an ArrayList. The really strange > ... >> for (DisplayBox box : boxes) { > ... >> boxes.remove(box); > > This is an FAQ. Try using the iterator directly and then use Iterator#remove. > Stefan: I don't know why my previous reply didn't show up but you are correct, I am seriously confused. But your reply did allow me to correct my problem. Thanks, -- Knute Johnson