詳解HashMap和Hashtable

1.底層結構:HashMap和Hashtable的底層結構是都是數組加鏈表; 2.安全性:HashMap 是非線程安全的,HashTable 是線程安全的;HashTable 內部的方法基本都通過synchronized 修飾(若是你要保證線程安全的話就使用Concurre ntHashMap吧); 3.對null鍵和null值的支持:HashMap支持null鍵和null值,能夠有多個null值
相關文章
相關標籤/搜索