Now I want to make HashMap synchronized .Is there any way I can do the same without using Synchronized keyword ConcurrentHashMap?or ? That is I dont want to put all the methods inside a Synchronized block .
            Asked
            
        
        
            Active
            
        
            Viewed 526 times
        
    1 Answers
2
            
            
        Now I want to make ArrayList and HashMap synchronized .Is there any way I can do the same without using Synchronized keyword ?
Sure:
- Use a - ConcurrentHashMapand any of the several- Listimplementations in- java.util.concurrent.
- Use - Collections.synchronizedMapand- Collections.synchronizedList.
 
    
    
        T.J. Crowder
        
- 1,031,962
- 187
- 1,923
- 1,875
- 
                    
- 
                    @dilshad: You mean like `Map map = Collections.synchronizedMap(new HashMap());`? – T.J. Crowder Mar 10 '15 at 11:21
- 
                    no i mean about create own synchronized hashmap using some kind of login – dilshad Mar 10 '15 at 12:11
- 
                    
