Hashmap源码解析-与hashtable区别

HashMap是非线程安全的,HashTable是线程安全的。

系列目录#

  1. 总览&目录
  2. 链表节点NODE
  3. 构造函数
  4. 扩容函数
  5. put
  6. remove
  7. get
  8. 遍历
  9. &hashtable

hashmap & hashtable#

(1)HashMap是非线程安全的,HashTable是线程安全的。

(2)因为线程安全、哈希效率的问题,HashMap效率比HashTable的要高

(3)HashMap的键和值都允许有null存在,而HashTable则都不行。

(4)HashMap的迭代器(Iterator)是fail-fast迭代器,而Hashtable的enumerator迭代器不是fail-fast的

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×