aspose file tools
The moose likes Threads and Synchronization and the fly likes Hashtable and HashMap Synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Hashtable and HashMap Synchronization" Watch "Hashtable and HashMap Synchronization" New topic
Author

Hashtable and HashMap Synchronization

James Davison
Greenhorn

Joined: Mar 28, 2004
Posts: 27
If you synchronize on a HashMap object, is there any difference (at that point) between a Hashtable and a HashMap? If so, please explain.
Also, for a Hashtable (or a synchronized HashMap) object, should you synchronize on an Object contained with the map prior to updating its contents? If so, would it be better to synchronize the method on the Object that updates the contents?
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1328
The synchronized HashMap would still permit nulls, which the Hashtable doesn't. The Hashtable would still support some older methods that the HashMap doesn't (such as the elements() method).
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: Hashtable and HashMap Synchronization
 
Similar Threads
Synchronized HashMap Vs Hashtable
How to make ArraList and HashMap methods synchronized
Hashtables, objects & casting
Locking a record
HashMap or HashTable