Java HashMap vs HashTable

二者的区别:HashTable 是全部的方法都加锁。code

  1. First and most significant different between Hashtable and HashMap is that, HashMap is not thread-safe while Hashtable is a thread-safe collection.orm

  2. Second important difference between Hashtable and HashMap is performance, since HashMap is not synchronized it perform better than Hashtable.it

  3. Third difference on Hashtable vs HashMap is that Hashtable is obsolete class and you should be using ConcurrentHashMap in place of Hashtable in Java.io

相关文章
相关标签/搜索