velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Mutating a collection
Date Wed, 17 Nov 2010 21:27:56 GMT
Jian,

On 11/17/2010 4:19 PM, jian chen wrote:
> It seems to me that in java, Iterator can not be modified during the
> iteration loop. It is not particular to Velocity though.

http://download.oracle.com/javase/6/docs/api/java/util/Iterator.html#remove()

You may need to update your interview questions ;)

> If you want to remove elements, maybe during the loop, you could mark the
> indexes for the items to be removed, then, remove them afterwards?

That's an idea, though much less convenient than calling "remove" on an
iterator.

Thanks,
-chris


Mime
View raw message