std/collections/arraylist
std/collections/arraylist — generic growable array ArrayList<T>.
Pure-Axle dynamic array over the four mono dimensions
(i32 / i64 / f64 / string). Each instantiation is fully
monomorphised, so ArrayList<i32> and ArrayList<string> carry no
virtual dispatch and inline cleanly at call sites.
Backing store:
data : T[cap] — libc_malloc allocation addressed as a T[],
the first len slots hold the live elements.
len : i64 — element count.
cap : i64 — allocated slot count; doubles when len hits it.add is amortised O(1) (geometric growth ×2). get returnsT | null — null for an out-of-range index, so get(i) ?? fallback
is the idiomatic checked read. set / removeAt bound-check and
raise IndexOutOfBoundsException (a write to a missing slot is a
programming error, not an absent value). indexOf / contains scan
with ==; for T = f64 a NaN element is never found (NaN != NaN),
matching the semantics of Axle's float comparison.
The data array is a dynamic array — the compiler's auto-free
transform releases the old buffer after a grow (the resized copy
is kept) and the live buffer when the list itself is dropped.
Free functions
| Type | Method and description |
|---|---|
| __floorLog2(n : i64) : i64 floor(log2 n) for n >= 1 — the base of the introsort recursion-depthbudget, past which a range falls to heapsort. |
Method detail
#__floorLog2
floor(log2 n) for n >= 1 — the base of the introsort recursion-depth
budget, past which a range falls to heapsort.
C class ArrayList<T>
Constructors
| Type | Method and description |
|---|---|
| constructor() Build an empty list with an 8-slot backing buffer pre-allocated, so the first eight adds grow nothing. |
Method detail
#constructor
Build an empty list with an 8-slot backing buffer pre-allocated,
so the first eight adds grow nothing.