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.
Well, Java has quite a few list implementations that are smarter than arrays, though it doens't sound like you really want a sorted list from your description.
An ArrayList or LinkedList will do what you want as far as inserting or removing elements:
public Object remove(int index)
- Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).
Do you really want a sorted list, or just something higher-level than an array?