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

    //输出是有序的
}
posted @ 2019-09-05 15:45  fly_bk  阅读(705)  评论(0编辑  收藏  举报