A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Murach's Java Servlets and JSP
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.
It is sorta covered in the
JavaRanch Style Guide
subject: Doubt in Hash Map and Hash Table
which methods of vector and Hash table are synchronized?
Hash Table - Sychronization
Can we use Hashtable or Vector in a JSP page?
what does it mean that hashtable is synchronized and hashmaps are not?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014