|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArrayType
- Type of the primitive array; e.g., double[]
.BaseType
- Boxed type of the array element; e.g., Double
.public interface PrimitiveArray<ArrayType,BaseType>
Interface for primitive-type extensible arrays, modeled after
ArrayList
, but more performant.
For primitive type arrays, ArrayList
is not a good choice
because it uses boxing and unboxing to store the elements, leading to a large
memory footprint as well as performance penalties.
Method Summary | |
---|---|
int |
capacity()
Gets the current capacity of the backing array. |
ArrayType |
copyArray()
Returns a copy of the primitive-array array. |
BaseType |
defaultValue()
|
void |
delete(int index,
int count)
Shifts the array to delete space starting at a specified index. |
void |
ensureCapacity(int minCapacity)
Makes sure the backing array at least a specified capacity. |
ArrayType |
getArray()
Gets the fixed-size array backing this instance. |
int |
getMaximumGrowth()
Gets the maximal step size by which to grow the fixed-size array when running out of space. |
void |
insert(int index,
int count)
Shifts the array to insert space at a specified index. |
void |
setArray(ArrayType array)
Sets the fixed-size array backing this instance. |
void |
setMaximumGrowth(int growth)
Sets the maximal step size by which to grow the fixed-size array when running out of space. |
Methods inherited from interface java.util.List |
---|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray |
Methods inherited from interface org.scijava.util.Sizable |
---|
setSize, size |
Method Detail |
---|
ArrayType getArray()
void setArray(ArrayType array)
array
- the new backing arrayint getMaximumGrowth()
void setMaximumGrowth(int growth)
ArrayType copyArray()
The returned array is guaranteed to have List.size()
elements.
int capacity()
void ensureCapacity(int minCapacity)
After calling this method, the internal array will have at least
minCapacity
elements.
minCapacity
- the minimum capacityvoid insert(int index, int count)
index
- the index where the space should be insertedcount
- the number of values to insertvoid delete(int index, int count)
index
- the index where the space should be deletedcount
- the number of values to deleteBaseType defaultValue()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |