ConcurrentHashMap and Hash table difference

This question already has an answer here:

  • Differences between HashMap and Hashtable? 38 answers

  • concurrentHashMap - Lock free algorithm. There is no synchronization between read or write operation. As per java Doc

    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updates. This class obeys the same functional specification as Hashtable, and includes versions of methods corresponding to each method of Hashtable. However, even though all operations are thread-safe, retrieval operations do not entail locking, and there is not any support for locking the entire table in a way that prevents all access. This class is fully interoperable with Hashtable in programs that rely on its thread safety but not on its synchronization details.

    HashTable - Everything is synchronized. Its completely synchronized between read and write operation

    链接地址: http://www.djcxy.com/p/16354.html

    上一篇: 何时使用Comparable和Comparator

    下一篇: ConcurrentHashMap和Hash表的区别