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()
DynamicArray
clear
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
public DynamicObjectArray<T> ensureCapacity(int capacity)
DynamicArray
ensureCapacity
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
capacity
- the desired capacity.public int size()
DynamicArray
size
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
public int capacity()
DynamicArray
capacity
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
public T[] values()
DynamicArray
values
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
public Class<T> getComponentType()
DynamicArray
getComponentType
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
public String toString()
DynamicArray
toString
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
toString
in class Object
public DynamicObjectArray<T> clone()
DynamicArray
clone
in interface DynamicArray<DynamicObjectArray<T>,T[],T>
clone
in class Object