-1

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 .

dilshad
  • 734
  • 1
  • 10
  • 27

1 Answers1

2

Now I want to make ArrayList and HashMap synchronized .Is there any way I can do the same without using Synchronized keyword ?

Sure:

  1. Use a ConcurrentHashMap and any of the several List implementations in java.util.concurrent.

  2. Use Collections.synchronizedMap and Collections.synchronizedList.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875