T
- - type of the elements in the list.public class SortedCopyOnWriteArray<T extends java.lang.Comparable<T>>
extends java.lang.Object
implements java.lang.Iterable<T>, java.util.Collection<T>
Constructor and Description |
---|
SortedCopyOnWriteArray()
Construct an empty sorted array.
|
SortedCopyOnWriteArray(java.util.Collection<T> wrapped)
Create a sorted array from the given list.
|
SortedCopyOnWriteArray(java.util.Collection<T> wrapped,
boolean sort)
Create a sorted array from the given list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T value)
Inserts the given element in the proper location.
|
boolean |
addAll(java.util.Collection<? extends T> values) |
void |
clear() |
boolean |
contains(java.lang.Object value) |
boolean |
containsAll(java.util.Collection<?> values) |
T |
get(int index)
Retrieves an element by index.
|
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator()
Retrieves an iterator over the elements in the given list.
|
void |
remove(int index)
Removes from the list by making a copy of every element except the one with the given index.
|
boolean |
remove(java.lang.Object value)
Removes from the list by making a new list with every element except the one given.
|
boolean |
removeAll(java.util.Collection<?> values) |
boolean |
retainAll(java.util.Collection<?> values) |
int |
size()
Retrieve the size of the list.
|
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
public SortedCopyOnWriteArray()
public SortedCopyOnWriteArray(java.util.Collection<T> wrapped)
wrapped
- - the collection whose elements are to be placed into the list.public SortedCopyOnWriteArray(java.util.Collection<T> wrapped, boolean sort)
wrapped
- - the collection whose elements are to be placed into the list.sort
- - TRUE to automatically sort the collection, FALSE if it is already sorted.public boolean add(T value)
public boolean addAll(java.util.Collection<? extends T> values)
public boolean remove(java.lang.Object value)
Objects will be compared using the given objects equals() method.
public boolean removeAll(java.util.Collection<?> values)
public boolean retainAll(java.util.Collection<?> values)
public void remove(int index)
index
- - index of the element to remove.public T get(int index)
index
- - index of element to retrieve.public int size()
public java.util.Iterator<T> iterator()
public void clear()
public boolean contains(java.lang.Object value)
public boolean containsAll(java.util.Collection<?> values)
public boolean isEmpty()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public java.lang.String toString()
toString
in class java.lang.Object