1.list集合
a.故障现象
异常:java.util.ConcurrentModificationException
b.导致原因:
并发读写
c.解决方案:
List list = new Vector();List list = new Collections.synchronizedList(new ArrayList<>());
List list = new CopyOnWriteArrayList();
加了ReentrantLock锁
2.set
底层结构 HashMap 为什么add() 只关心key value为常量
解决方案:
Set set = Collections.synchronizedSet(new HashSet<>());
Set set = new CopyOnWriteArraySet();
3.map
解决方案:
Map map = new ConcurrentHashMap();