posted 16 years ago
It doesn't. You can't directly modify the collection while iterating. You'll get a ConcurrentModificationException.
The one exception is that you can remove from the collection, by using the remove() method of Iterator, not the remove() method of the collection. Supporting remove() in an Iterator implementation is optional, but ArrayList does support it.
Note that you have written hasMoreElements(), but Iterator has no such method; it is hasNext(). You're thinking of Enumeration, which is mostly obsolete.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.