zoukankan      html  css  js  c++  java
  • JUC集合之 ConcurrentSkipListSet

    ConcurrentSkipListSet介绍

    ConcurrentSkipListSet是线程安全的有序的集合,适用于高并发的场景。
    ConcurrentSkipListSet和TreeSet,它们虽然都是有序的集合。但是,第一,它们的线程安全机制不同,TreeSet是非线程安全的,而ConcurrentSkipListSet是线程安全的。第二,ConcurrentSkipListSet是通过ConcurrentSkipListMap实现的,而TreeSet是通过TreeMap实现的。

    ConcurrentSkipListSet原理和数据结构

    ConcurrentSkipListSet的数据结构,如下图所示:

    说明:
    (01) ConcurrentSkipListSet继承于AbstractSet。因此,它本质上是一个集合。
    (02) ConcurrentSkipListSet实现了NavigableSet接口。因此,ConcurrentSkipListSet是一个有序的集合。
    (03) ConcurrentSkipListSet是通过ConcurrentSkipListMap实现的。它包含一个ConcurrentNavigableMap对象m,而m对象实际上是ConcurrentNavigableMap的实现类ConcurrentSkipListMap的实例。ConcurrentSkipListMap中的元素是key-value键值对;而ConcurrentSkipListSet是集合,它只用到了ConcurrentSkipListMap中的key!

  • 相关阅读:
    简单的股票分析系统
    gtest日志在工程项目中的应用
    doctest初次体验
    python写的读取json配置文件
    logbook日志系统
    python3 pyodbc简单使用
    numpy中dtype
    python获取代码行号
    Python操作SQLServer示例(转)
    log4j与log4j.properties的配置
  • 原文地址:https://www.cnblogs.com/cag2050/p/7384664.html
Copyright © 2011-2022 走看看