Does java have a skip list implementation

后端 未结 7 1511
北恋
北恋 2021-02-13 03:51

I find ConcurrentSkipListSet in Java Collection Framework, which is backed up with a skip list. But is there a skip list in Java? A set does not work in my use case. I need a in

相关标签:
7条回答
  • 2021-02-13 04:20

    When you create a ConcurrentSkipListSet, you pass a comparator to the constructor.

    new ConcurrentSkipListSet<>(new ExampleComparator());
    
    public class ExampleComparator implements Comparator<Event> {//your impl }
    

    You could create a comparator that will make your SkipListSet behave as a normal List.

    0 讨论(0)
提交回复
热议问题