Java 并发编程之 ConcurrentSkipListSet
Java juc About 1,085 words介绍
线程安全的排序集合。
原理
ConcurrentSkipListSet
底层是使用ConcurrentSkipListMap
实现。
public ConcurrentSkipListSet() {
m = new ConcurrentSkipListMap<E,Object>();
}
具体可参考前一篇文章:Java 并发编程之 ConcurrentSkipListMap
跳跃列表
Head nodes Index nodes
+-+ right +-+ +-+
|2|---------------->| |--------------------->| |->null
+-+ +-+ +-+
| down | |
v v v
+-+ +-+ +-+ +-+ +-+ +-+
|1|----------->| |->| |------>| |----------->| |------>| |->null
+-+ +-+ +-+ +-+ +-+ +-+
v | | | | |
Nodes next v v v v v
+-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+
| |->|A|->|B|->|C|->|D|->|E|->|F|->|G|->|H|->|I|->|J|->|K|->null
+-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+
put 示意图
跳跃列表
Views: 1,583 · Posted: 2021-11-04
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...