Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Hash Map and Hash Table

 
Prasad Chelur
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
HTH,
- Manish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic