SortedCollectionInterface defines an interface for an ordered collection
which preserves a sort order when inserting items.
The sorted collection is constructed with a Comparator which is
used to determine where the items are inserted.
The SortedCollectionInterface extends CollectionInterface with which you
can add items, test if an item exists, gett the item count, obtain an enumeration of the elements.
It also extends StaticOrderedCollectionInterface by which you can access
items by their integer index [0..count()-1]. This interface adds
the sort() and removeAt(int) methods. Note that
the OrderedCollectionInterface methods such as
set(int, Object) are not in this interface, since arbitrarily setting
items in a sorted collection may render the collection unsorted.
The behavior of a SortedCollection is undefined if
the Comparator is null or if the comparator cannot compare two items
(i.e. if the comparator ever returns @{link com.sas.util.Comparator#INCOMPARABLE Comparator.INCOMPARABLE})
Methods inherited from interface com.sas.util.Countable
count
Method Detail
sort
void sort()
Re-sort this collection. This may be necessary if one or more of the
items in this collection have changed in such a way that the
collection is out of order. The collection will emit a ContentsChangedEvent.
removeAt
void removeAt(int index)
Remove the item at the specificed position.
This sorted collection will emit a ContentsChangedEvent.
Parameters:
index - the index of the item to remove from the sorted collection.