On Mon, Apr 14, 2008 at 4:46 PM, Michael Rogers <m.rogers at cs.ucl.ac.uk> 
wrote:
> On Apr 14 2008, Daniel Cheng wrote:
>  >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.
>
>  Thanks!
>
>
>  >Hashtable is for JDK1.1 compatibility. new code should use other
>  >java.util.Map instead.
>
>  Not necessarily - Hashtable is threadsafe IIRC but HashMap isn't (likewise
>  for Vector vs ArrayList, etc).
>

Hashtable is threadsafe -- yes, but I prefer using
Collections.synchronizedMap() and
java.util.concurrent.ConcurrentHashMap.

When loading is high, ConcurrentHashMap give much better performance
as it is lock free.
The sad news is it's only available on java 5/later.

> <snip>

Regards,
Daniel Cheng

Reply via email to