aspose file tools
The moose likes Java in General and the fly likes How to synchronize HashMap Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to synchronize HashMap" Watch "How to synchronize HashMap" New topic
Author

How to synchronize HashMap

Vinney Shanmugam
Ranch Hand

Joined: Aug 27, 2008
Posts: 104
I did get a question from one of my colleauge that " How to synchronize a HashMap? "

The reply was access your HashMap from within a Synchronized method.

Is it correct?
Istvan Kovacs
Ranch Hand

Joined: May 06, 2010
Posts: 100
Check methods of java.util.Collections (the class, not the Collection interface) for an answer.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
That's one way to do it.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to synchronize HashMap
 
Similar Threads
Locking strategy
Java Clarifications..help needed
How synchronize between Threads ?
HashMap, lock + unlock
Implementing Lock/Unlock