面试题:介绍下HashTable

(1):在hashmap方法上很多方法都是用synchronized修饰
(2):不允许键值为null
(3):容量:HashMap底层数组长度必须为2的幂,这样做是为了hash准备,默认为16;而HashTable底层数组长度可以为任意值,这就造成了hash算法散射不均匀,容易造成hash冲突,默认为11;
(4)继承关系:HashTable继承自Dictionary类;而HashMap继承自AbstractMap类;
②ConcurrentHashMap:

Guess you like

Origin blog.csdn.net/qq_45283095/article/details/121805844
Recommended