Re: Whats wrong with this code....
- From: "Matt Humphrey" <matth@xxxxxxxxxxxxxx>
- Date: Thu, 7 Apr 2005 07:42:58 -0400
"John McGrath" <ng@xxxxxxxxxxxxx> wrote in message
news:xn0e0ov2e5087vl009@xxxxxxxxxxxxxxxxxxx
> On 4/6/2005 at 6:58:43 PM, is0871@xxxxxxxxx wrote:
>
> > If you can figure out whats wrong in the above code(wihout compiling)
>
> One obvious problem is that you are iterating over a collection and
> adding to the same collection in the process. This will result in a
> ConcurrentModificationException.
You're quite right that adding to a collection while iterating over it is
usually a bad idea, although I don't think it's possible to tell exactly
what will happen because we don't know the actual class for either the
iterator or the collection. Aside from compilation errors, without knowing
what the fragment is supposed to do it's impossible to say how it might be
wrong.
Cheers,
Matt Humphrey matth@xxxxxxxxxxxxxx http://www.iviz.com/
.
- Follow-Ups:
- Re: Whats wrong with this code....
- From: John McGrath
- Re: Whats wrong with this code....
- From: Thomas Weidenfeller
- Re: Whats wrong with this code....
- References:
- Whats wrong with this code....
- From: is0871
- Re: Whats wrong with this code....
- From: John McGrath
- Whats wrong with this code....
- Prev by Date: Re: Is it possible to loadlibrary() two different libs for the "same" java class?
- Next by Date: Re: ImageProcessing Group
- Previous by thread: Re: Whats wrong with this code....
- Next by thread: Re: Whats wrong with this code....
- Index(es):
Relevant Pages
|