
T - the component type.public class DynamicObjectArray<T> extends Object implements DynamicArray<DynamicObjectArray<T>,T[],T>
DynamicArray for objects.| Modifier and Type | Field and Description |
|---|---|
static int |
INITIAL_CAPACITY
The initial capacity.
|
| Modifier | Constructor and Description |
|---|---|
|
DynamicObjectArray(Class<T> clazz)
Default constructor.
|
|
DynamicObjectArray(Class<T> clazz,
int capacity)
Alternate constructor.
|
protected |
DynamicObjectArray(T[] values,
int size)
Alternate constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
capacity()
Gets the capacity.
|
DynamicObjectArray<T> |
clear()
Clears this array.
|
DynamicObjectArray<T> |
clone()
Clones this array.
|
DynamicObjectArray<T> |
ensureCapacity(int capacity)
Ensures that this array has at least the given capacity.
|
T |
get(int index)
Gets the value at the given index.
|
Class<T> |
getComponentType()
Gets the component type.
|
T |
pop()
Pops off the last pushed on value.
|
DynamicObjectArray<T> |
push(T value)
Pushes on a value.
|
DynamicObjectArray<T> |
push(T value,
int index)
Sets a value at the given index.
|
int |
size()
Gets the number of elements.
|
String |
toString()
Creates a human-readable representation of this array.
|
T[] |
values()
Gets the storage array truncated to the current size.
|
public static final int INITIAL_CAPACITY
protected DynamicObjectArray(T[] values, int size)
public T get(int index)
public DynamicObjectArray<T> push(T value, int index)
public T pop()
public DynamicObjectArray<T> push(T value)
public DynamicObjectArray<T> clear()
DynamicArrayclear in interface DynamicArray<DynamicObjectArray<T>,T[],T>public DynamicObjectArray<T> ensureCapacity(int capacity)
DynamicArrayensureCapacity in interface DynamicArray<DynamicObjectArray<T>,T[],T>capacity - the desired capacity.public int size()
DynamicArraysize in interface DynamicArray<DynamicObjectArray<T>,T[],T>public int capacity()
DynamicArraycapacity in interface DynamicArray<DynamicObjectArray<T>,T[],T>public T[] values()
DynamicArrayvalues in interface DynamicArray<DynamicObjectArray<T>,T[],T>public Class<T> getComponentType()
DynamicArraygetComponentType in interface DynamicArray<DynamicObjectArray<T>,T[],T>public String toString()
DynamicArraytoString in interface DynamicArray<DynamicObjectArray<T>,T[],T>toString in class Objectpublic DynamicObjectArray<T> clone()
DynamicArrayclone in interface DynamicArray<DynamicObjectArray<T>,T[],T>clone in class Object