|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.util.SortedList<E>
public class SortedList<E>
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.
| Constructor Summary | |
|---|---|
SortedList(Collection<? extends E> c,
Comparator<? super E> comparator)
Constructs a list containing the elements of the given collection, in the order returned by the collection's iterator, that will be sorted with the given comparator. |
|
SortedList(Comparator<? super E> comparator)
Constructs an empty list with the default initial capacity that will be sorted using the given comparator. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(E e)
|
|
void |
add(int index,
E element)
|
|
boolean |
addAll(Collection<? extends E> c)
|
|
boolean |
addAll(int index,
Collection<? extends E> c)
|
|
void |
clear()
|
|
boolean |
contains(Object o)
|
|
boolean |
containsAll(Collection<?> c)
|
|
List<E> |
get()
Returns a reference to the unmodifiable list currently backing the SortedList. |
|
E |
get(int index)
|
|
int |
indexOf(Object o)
|
|
boolean |
isEmpty()
|
|
Iterator<E> |
iterator()
|
|
int |
lastIndexOf(Object o)
|
|
ListIterator<E> |
listIterator()
|
|
ListIterator<E> |
listIterator(int index)
|
|
E |
remove(int index)
|
|
boolean |
remove(Object o)
|
|
boolean |
removeAll(Collection<?> c)
|
|
boolean |
retainAll(Collection<?> c)
|
|
E |
set(int index,
E element)
|
|
int |
size()
|
|
List<E> |
subList(int fromIndex,
int toIndex)
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public SortedList(Comparator<? super E> comparator)
comparator - the comparator
public SortedList(Collection<? extends E> c,
Comparator<? super E> comparator)
c - the collectioncomparator - the comparator| Method Detail |
|---|
public List<E> get()
public int size()
size in interface Collection<E>size in interface List<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface List<E>public boolean contains(Object o)
contains in interface Collection<E>contains in interface List<E>public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in interface List<E>public Object[] toArray()
toArray in interface Collection<E>toArray in interface List<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>toArray in interface List<E>public boolean add(E e)
add in interface Collection<E>add in interface List<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface List<E>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface List<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in interface List<E>
public boolean addAll(int index,
Collection<? extends E> c)
addAll in interface List<E>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>removeAll in interface List<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>retainAll in interface List<E>public void clear()
clear in interface Collection<E>clear in interface List<E>public E get(int index)
get in interface List<E>
public E set(int index,
E element)
set in interface List<E>
public void add(int index,
E element)
add in interface List<E>public E remove(int index)
remove in interface List<E>public int indexOf(Object o)
indexOf in interface List<E>public int lastIndexOf(Object o)
lastIndexOf in interface List<E>public ListIterator<E> listIterator()
listIterator in interface List<E>public ListIterator<E> listIterator(int index)
listIterator in interface List<E>
public List<E> subList(int fromIndex,
int toIndex)
subList in interface List<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||