Asdfasf

Thursday, September 25, 2014

EJ-69 Prefer ConcurrentHashMap to HashTable and if synchronization is required to HashMap

Ref: Effective Java by Joshua Bloch

There are lots of resources about HashTable vs HashMap vs ConcurrentHashMap . The main point is around synchronization. Hashtable is synchronized, whereas HashMap is not. This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones. On the other hand, if you need better performing synchronization, you should use ConcurrentHashMap. In this article, it is simply explained how ConcurrentHashMap performs better than HashTable.

No comments: