List
Generic doubly-linked list
unknown
List container object
self;add
Append a value to the end of the list
U0 add(List<T> list, T value);Parameters
list— Target listvalue— Value to append
addAt
Insert a value at a specific index
U0 addAt(List<T> list, T value, I32 index);Parameters
list— Target listvalue— Value to insertindex— Zero-based position
remove
Remove the first matching value from the list
U8 remove(List<T> list, T value);Parameters
list— Target listvalue— Value to find and remove
Returns — Non-zero if element was found and removed
removeAt
Remove the element at a specific index
U0 removeAt(List<T> list, I32 index);Parameters
list— Target listindex— Zero-based position to remove
get
Get a reference to the element at a specific index
T& get(List<T> list, I32 index);Parameters
list— Target listindex— Zero-based position
Returns — Reference to the element
set
Set the value of an element at a specific index
U0 set(List<T> list, I32 index, T value);Parameters
list— Target listindex— Zero-based positionvalue— New value
first
Get a reference to the first element
T& first(List<T> list);Parameters
list— Target list
Returns — Reference to first element (undefined behavior if empty)
last
Get a reference to the last element
T& last(List<T> list);Parameters
list— Target list
Returns — Reference to last element (undefined behavior if empty)
size
Get the number of elements in the list
U64 size(List<T> list);Parameters
list— Target list
Returns — Element count
clear
Remove all elements from the list
U0 clear(List<T> list);Parameters
list— Target list