public class DelayedRemovalArray<T> extends Array<T>
begin() is called to occur once end() is called. This can allow code out of
your control to remove items without affecting iteration. Between begin and end, most mutator methods will throw
IllegalStateException. Only removeIndex(int), removeValue(Object, boolean), removeRange(int, int),
clear(), and add methods are allowed.
Code using this class must not rely on items being removed immediately. Consider using SnapshotArray if this is a
problem.
Array.ArrayIterable<T>, Array.ArrayIterator<T>| Constructor and Description |
|---|
DelayedRemovalArray() |
DelayedRemovalArray(Array array) |
DelayedRemovalArray(boolean ordered,
int capacity) |
DelayedRemovalArray(boolean ordered,
int capacity,
java.lang.Class arrayType) |
DelayedRemovalArray(boolean ordered,
T[] array,
int startIndex,
int count) |
DelayedRemovalArray(java.lang.Class arrayType) |
DelayedRemovalArray(int capacity) |
DelayedRemovalArray(T[] array) |
| Modifier and Type | Method and Description |
|---|---|
void |
begin() |
void |
clear() |
void |
end() |
void |
insert(int index,
T value) |
T |
pop()
Removes and returns the last item.
|
T |
removeIndex(int index)
Removes and returns the item at the specified index.
|
void |
removeRange(int start,
int end)
Removes the items between the specified indices, inclusive.
|
boolean |
removeValue(T value,
boolean identity)
Removes the first instance of the specified value in the array.
|
void |
reverse() |
void |
set(int index,
T value) |
T[] |
setSize(int newSize)
Sets the array size, leaving any values beyond the current size null.
|
void |
shuffle() |
void |
sort()
Sorts this array.
|
void |
sort(java.util.Comparator<? super T> comparator)
Sorts the array.
|
void |
swap(int first,
int second) |
void |
truncate(int newSize)
Reduces the size of the array to the specified size.
|
static <T> DelayedRemovalArray<T> |
with(T... array) |
add, addAll, addAll, addAll, addAll, contains, ensureCapacity, equals, first, get, hashCode, indexOf, iterator, lastIndexOf, of, of, peek, random, removeAll, resize, select, selectRanked, selectRankedIndex, shrink, toArray, toArray, toString, toStringpublic DelayedRemovalArray()
public DelayedRemovalArray(Array array)
public DelayedRemovalArray(boolean ordered,
int capacity,
java.lang.Class arrayType)
public DelayedRemovalArray(boolean ordered,
int capacity)
public DelayedRemovalArray(boolean ordered,
T[] array,
int startIndex,
int count)
public DelayedRemovalArray(java.lang.Class arrayType)
public DelayedRemovalArray(int capacity)
public DelayedRemovalArray(T[] array)
public void begin()
public void end()
public boolean removeValue(T value, boolean identity)
ArrayremoveValue in class Array<T>value - May be null.identity - If true, == comparison will be used. If false, .equals() comparison will be used.public T removeIndex(int index)
ArrayremoveIndex in class Array<T>public void removeRange(int start,
int end)
ArrayremoveRange in class Array<T>public void sort()
ArrayComparable. This method is not thread safe (uses
Sort.instance()).public void sort(java.util.Comparator<? super T> comparator)
ArraySort.instance()).public void truncate(int newSize)
Arraypublic T[] setSize(int newSize)
ArraysetSize in class Array<T>Array.itemspublic static <T> DelayedRemovalArray<T> with(T... array)
DelayedRemovalArray(Object[])