A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
Other JSE/JEE APIs
Doubt in Hash Map and Hash Table
Joined: Feb 12, 2002
May 26, 2003 04:54:00
I knew Hash table is synchronized and Hash Map is not synchronized.
my question which method in Hash Table is sychronized.
Is there any way that we can make Hash Map synchronized.If yes how?
Joined: Sep 22, 2001
May 26, 2003 05:09:00
The Hashtable is thread-safe, and if you want to make
threadsafe, you can use -
Map m = Collections.synchronizedMap(new HashMap(...)); //from the API DOCs
Or you can obtain a lock on hashmap object as and when you require it for a synchronized block.
I agree. Here's the link:
subject: Doubt in Hash Map and Hash Table
what does it mean that hashtable is synchronized and hashmaps are not?
Hash Table - Sychronization
which methods of vector and Hash table are synchronized?
Can we use Hashtable or Vector in a JSP page?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014