2006/4/20, Peter Szinek <peter / rt.sk>:
> > items.each do |x|
> >       if x == ""
> >               items.delete(x)
> >       end
> > end
> Wow, in Java you this would throw ConcurrentModificationException (i.e.
> you can not iterate and modify a list at the same time, says Java) -
> AFAIK, in java there is no workaround for this.

Not exactly true. This special scenario is well covered by Java:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html#remove()

Std. collections all support remove().

IMHO iterating and deleting like shown is a very bad idea.  Since
there is a method for doing deletions that's exactly the way to go.

Kind regards

robert

--
Have a look: http://www.flickr.com/photos/fussel-foto/