[freenet-dev] Classpath vs. Sun-Java diffs
Daniel Cheng
j16sdiz+freenet at gmail.com
Sun Apr 13 23:45:22 UTC 2008
On Sun, Apr 13, 2008 at 11:02 PM, Michael Rogers <m.rogers at cs.ucl.ac.uk> wrote:
> I agree it would be nice if the JVM threw an exception but it's not a
> bug if it fails to do so - see
> http://java.sun.com/j2se/1.4.2/docs/api/java/util/ConcurrentModificationException.html
>
> "Fail-fast operations throw ConcurrentModificationException on a
> best-effort basis. Therefore, it would be wrong to write a program that
> depended on this exception for its correctness:
> ConcurrentModificationException should be used only to detect bugs."
>
> Mind you, that's for Iterators - I'm not sure that Enumerations even
> check for concurrent modification.
Check http://java.sun.com/j2se/1.4.2/docs/api/java/util/Hashtable.html .
: The Enumerations returned by Hashtable's keys and values methods are
not fail-fast.
i.e. It won't throw ConcurrentModificationException.
Hashtable is for JDK1.1 compatibility. new code should use other
java.util.Map instead.
Regards,
Daniel Cheng
More information about the Devl
mailing list