一、HashMap
https://blog.csdn.net/qq_41345773/article/details/92066554
红黑树:平衡二叉查找树。当链表超过8时,链表就转换为红黑树,利用红黑树快速增删改查的特点提高HashMap的性能,其中会用到红黑树的插入、删除、查找等算法。
https://blog.csdn.net/woshimaxiao1/article/details/83661464
二、SecurityHashMap
public void testCollectionsSecurityMap(){ HashMap<Integer,user>map=new HashMap<>(); map.put(1,new user("name0",0)); map.put(2,new user("name1",1)); map=new HashMap(Collections.synchronizedMap(map)); System.out.println(map.keySet()); } 在集合中 Vector 和 HashTable 倒是线程安全的。 你打开源码会发现其实就是把各自核心方法添加上了synchronized 关键字。 Collections.synchronizedCollection(c) Collections.synchronizedList(list) Collections.synchronizedMap(m) Collections.synchronizedSet(s) 上面几个函数都有对应的返回值类型,传入什么类型返回什么类型。打开源码其实实现原理非常简单,就是将集 合的核心方法添加上了 synchronized 关键字。三、CocurrentHashMap
1、Synchronized与ReentrantLock区别总结
https://blog.csdn.net/zxd8080666/article/details/83214089看代码;
2.CocurrentHashMap
https://blog.csdn.net/qq_41737716/article/details/90549847
https://www.jianshu.com/p/865c813f2726
https://www.jianshu.com/p/d0b37b927c48