Java: Sorted collection which allows duplicates, is memory efficient and provides fast insert + update

前端 未结 6 1104
野的像风
野的像风 2020-12-15 05:11

Specifically I need a collection which uses one field A for accessing and a different one (field S) for sorting but a sorted collection which accepts duplicate would be suff

6条回答
  •  时光取名叫无心
    2020-12-15 05:56

    I would go with skiplist - more memory efficient than a tree, allows duplicates, provides O(logn) for inserts and deletes. You can even implement an indexed skiplist, it will allow you to have indexed access, something that's hard to get with a tree.

提交回复
热议问题