Any implementation of Ordered Set in Java?

后端 未结 10 1969
说谎
说谎 2020-12-01 09:00

If anybody is familiar with Objective-C there is a collection called NSOrderedSet that acts as Set and its items can be accessed as an Array

10条回答
  •  广开言路
    2020-12-01 09:12

    If we are talking about inexpensive implementation of the skip-list, I wonder in term of big O, what the cost of this operation is:

    YourType[] array = someSet.toArray(new YourType[yourSet.size()]);

    I mean it is always get stuck into a whole array creation, so it is O(n):

    java.util.Arrays#copyOf
    

提交回复
热议问题