Possible Duplicate:
sorted collection in java
I was wondering if Java has its own version of Sorted List, or if I need to create my own. I want the list to automatically update itself if something is removed. For example, if I remove something from the start of the list, or even in the middle, I want everything behind it to move up in the list, and the remaining null value space to be removed.
If you're really after the equivalent of a .NET SortedList
, which is actually a map ordered by its keys, then the closest equivalent is probably TreeMap
. That's actually more like SortedDictionary
than SortedList
, given that it's a tree rather than just a list, but it's probably the closest available option.
However, what you've described is more like ArrayList
, which is similar to .NET's List<T>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With