I had been reading this all over the net that ConcurrentHashMap is faster than Hashtable and Synchronized HashMap. I tried a small and simple program that measures write operations on the above mentioned Collections. I found the Hashtable is quick enough than Synchronized Map and ConcurrentHashMap. The order was
1) Hashtable
2) Synchronized Map
3) ConcurrentHashMap
I am shooked to see that ConcurrentHashMap took the maximum time to perform similar operations. I executed the program several times and the order remained the same throughout.
I have attached the source code for the same. Please let me know if I am doing something wrong.
Look for “Save file to your PC : click here”

Tags: ,