ConcurrentSkipListMap--跳表的简单使用


import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;

/**
 *  跳表的使用
 */
public class ConcurrentSkipListMapDemo {
    public static void main(String[] args){
        ConcurrentSkipListMap<Integer, Integer> map = new ConcurrentSkipListMap<>();
        for (int i = 0; i < 30; i++) {
            map.put(i,i);
        }
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            System.out.println(entry.getKey());
        }
    }
    //0
    //1
    //2
    //3
    //4
    //5
    //6
    //7
    //8
    //9
    //10
    //11
    //12
    //13
    //14
    //15
    //16
    //17
    //18
    //19
    //20
    //21
    //22
    //23
    //24
    //25
    //26
    //27
    //28
    //29

    //输出是有序的
}
原文地址:https://www.cnblogs.com/fly-book/p/11466503.html