This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Doubt in Hash Map and Hash Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Doubt in Hash Map and Hash Table" Watch "Doubt in Hash Map and Hash Table" New topic

Doubt in Hash Map and Hash Table

Prasad Chelur

Joined: Feb 12, 2002
Posts: 10
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?

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2581

The Hashtable is thread-safe, and if you want to make HashMap threadsafe, you can use -

Or you can obtain a lock on hashmap object as and when you require it for a synchronized block.
- Manish
I agree. Here's the link:
subject: Doubt in Hash Map and Hash Table