A good Sorted List for Java

Posted by Phuong Nguyen de ManCity fan on Stack Overflow See other posts from Stack Overflow or by Phuong Nguyen de ManCity fan
Published on 2010-04-18T03:54:40Z Indexed on 2010/04/18 4:03 UTC
Read the original article Hit count: 242

Filed under:
|

I'm looking for a good sorted list for java. Googling around give me some hints about using TreeSet/TreeMap. But these components is lack of one thing: random access to an element in the set. For example, I want to access nth element in the sorted set, but with TreeSet, I must iterate over other n-1 elements before I can get there. It would be a waste since I would have upto several thousands elements in my Set.

Basically, I'm looking for some thing similar to a sorted list in .NET, with ability to add element fast, remove element fast, and have random access to any element in the list.

Has this kind of sorted list implemented somewhere? Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about sorting