Library / Collections / Sequences / NativeArray
NativeArray
NativeArray — what T[] and T[N+] are.
Constructors 2
INIT()CREATE(): room for four elements.
INIT(int64 n)
CREATE(n): room for n elements, with length 0.
Methods 15
METHOD length() RETURNS int64reads
The live elements.
METHOD capacity() RETURNS int64reads
The allocated slots.
MODIFY METHOD reserve(int64 n) RETURNS voidmodifies
Room for at least n elements, keeping the 79% growth trigger: the
incremental hint a caller appending in a loop gives.
MODIFY METHOD reserveExact(int64 n) RETURNS booleanmodifies
Room for exactly the n elements the caller names: no growth heuristic.
FALSE, with the array unchanged, when the block cannot be allocated.
MODIFY METHOD clear() RETURNS voidmodifies
Drop every element; length becomes 0 and the block is kept.
METHOD __op_index__(int64 i) RETURNS MUTABLE REFERENCE Treads
a[i] — a checked read: the cell, borrowed.
MODIFY METHOD __op_set_index__(int64 i, T value) RETURNS voidmodifies
a[i] = v — the high-water write (I.J.i): grows to i + 1 if needed, then the value moves in. A gap it opens reads as EMPTY / zero, or a value class's default (E1159).
MODIFY METHOD append(T value) RETURNS voidmodifies
The value moves in at the end: the write []= makes at index .length,
where there is no old value to take out.
MODIFY METHOD appendRange(REFERENCE NativeArray[T] other) RETURNS voidmodifies
Append a copy of every element of other, which may be this array.
MODIFY METHOD remove(int64 i) RETURNS Tmodifies
Move element i out, sliding the tail down one slot.
MODIFY METHOD swap(int64 i, int64 j) RETURNS voidmodifies
Exchange elements i and j.
METHOD copyTo(MUTABLE REFERENCE NativeArray[T] dst, int64 n) RETURNS voidreads
dst becomes a copy of this array's first n elements; its old ones are dropped.
MODIFY METHOD convertFrom(REFERENCE U[] src, int64 n) RETURNS voidmodifies
METHOD equals(REFERENCE NativeArray[T] other) RETURNS booleanreads
The same length and every element equal.
METHOD clone() RETURNS NativeArray[T]reads
A deep copy: each element's own copy.