Class SortedList<E>

java.lang.Object
org.apache.hadoop.hbase.util.SortedList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, RandomAccess

@Private public class SortedList<E> extends Object implements List<E>, RandomAccess
Simple sorted list implementation that uses ArrayList as the underlying collection so we can support RandomAccess. All mutations create a new copy of the ArrayList instance, so can be expensive. This class is only intended for use on small, very rarely written collections that expect highly concurrent reads.

Read operations are performed on a reference to the internal list at the time of invocation, so will not see any mutations to the collection during their operation. Iterating over list elements manually using the RandomAccess pattern involves multiple operations. For this to be safe get a reference to the internal list first using get().

If constructed with a Comparator, the list will be sorted using the comparator. Adding or changing an element using an index will trigger a resort.

Iterators are read-only. They cannot be used to remove elements.