|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nux.xom.binary.ArrayIntList
public final class ArrayIntList
Efficient resizable auto-expanding list holding int
elements;
implemented with arrays.
Constructor Summary | |
---|---|
ArrayIntList()
Constructs an empty list. |
|
ArrayIntList(int initialCapacity)
Constructs an empty list with the specified initial capacity. |
Method Summary | |
---|---|
void |
add(int elem)
Appends the specified element to the end of this list. |
void |
add(int[] elems,
int offset,
int length)
Appends the elements in the range [offset..offset+length) to the end of this list. |
int[] |
asArray()
Returns the elements currently stored, including invalid elements between size and capacity, if any. |
void |
clear()
Removes all elements but keeps the current capacity; Afterwards size() will yield zero. |
void |
ensureCapacity(int minCapacity)
Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory. |
int |
size()
Returns the number of contained elements. |
int[] |
toArray()
Returns a copied array of bytes containing all elements; the returned array has length = this.size(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayIntList()
public ArrayIntList(int initialCapacity)
initialCapacity
- the number of elements the receiver can hold without
auto-expanding itself by allocating new internal memory.Method Detail |
---|
public void add(int elem)
elem
- element to be appended to this list.public void add(int[] elems, int offset, int length)
[offset..offset+length)
to the end of this list.
elems
- the elements to be appendedoffset
- the offset of the first element to add (inclusive)length
- the number of elements to add
IndexOutOfBoundsException
- if indexes are out of range.public int[] asArray()
WARNING: For efficiency reasons and to keep memory usage low, the array is SHARED, not copied . So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing.
public void clear()
size()
will yield zero.
public void ensureCapacity(int minCapacity)
minCapacity
- the desired minimum capacity.public int size()
public int[] toArray()
|
Nux 1.6 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |