Tags
links:
– http://javarevisited.blogspot.com/2011/04/difference-between-concurrenthashmap.html
– http://stackoverflow.com/questions/40471/differences-between-hashmap-and-hashtable
– http://ria101.wordpress.com/2011/12/12/concurrenthashmap-avoid-a-common-misuse/
summary:
First in 1.0, we have legacy collection like Vector and HashTable.
They are all fully thread safe via locks.
Legacy containers:
– Enumeration
– Vector
– Stack (subclass of Vector)
– Dictionary
– Hashtable
– Properties
– etc
Then comes the collection framework consisting of ArrayList, HashMap, etc. They are not thread safe just doing collection.
All collection classes support Iterator so that users can iterate over all elements in the collection.
Collections:
– Iterator (vs Enumeration)
– ArrayList (vs Vector)
– Map (vs Dictionary)
– HashMap (vs Hashtable)
– etc
And finally we get the concurrent classes like CopyOnWriteArrayList, ConcurrentHashMap for fast thread safe access without the use of locks, and List interface and collection.
Concurrents:
– CopyOnWriteArrayList (vs ArrayList)
– ConcurrentHashMap (vs HashMap)
– BlockingQueue (interface)
– ArrayBlockingQueue
– CopyOnWriteArraySet
– ConcurrentLinkedQueue
– etc
Misuse of concurrenthaspmap, need to initialize it with parameter to get good performance.
3rd param concurrencyLevel could cause performance issue if not specified.