copyonwriteArrayList和concurrenthashmap
一、Hashmap和Concurrenthashmapjava7的concurrenthashmap结构java8的concurrenthashmap结构1.7数据结构segment+链表;采用分段锁的的方式,底层是reentrantlock,发生哈希碰撞采用拉链法;1.8采用键和值不能为null,数据结构node+链表+红黑树;并发度由原来的16变为每个node独立,采用CAS+Synchornized方法;查询复杂度O(N)降为O(logN);当链表元素大于8且数组容量大于64转化为红
复制链接