[Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
rmathew at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Apr 5 07:05:00 GMT 2006
------- Comment #4 from rmathew at gcc dot gnu dot org 2006-04-05 07:05 -------
(In reply to comment #2)
> The difference between Sun's and Classpath's implementation appears to be that
> Classpath will check for Concurrent Modification on both hasNext() and next()
> calls, while Sun's implementation only checks next() calls.
I would argue that Sun's implementation is correct in this case in the
sense that hasNext() doesn't actually modify anything, only next() does.
I agree that the user code is buggy, gets a potentially bogus answer with
hasNext() and is simply asking for trouble, but the said trouble doesn't
happen unless it actually calls next(). You cannot throw an exception on
me if I merely intend to screw up - do that only if I actually screw up.
My 2p.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028
More information about the Java-prs
mailing list