List<T>

Dynamic array with automatic resizing. Supports random access and iteration.

Type Constraints: T Constrains None

xxml
Language::Collections

Methods

MethodParametersReturnsDescription
ConstructorList<T>^Create empty list
addelement: T^NoneAdd to end
getindex: Integer^T^Get at index
setindex: Integer^, element: T^NoneSet at index
removeindex: Integer^NoneRemove at index
sizeInteger^Element count
isEmptyBool^Check if empty
clearNoneRemove all elements
containselement: T^Bool^Check if contains
indexOfelement: T^Integer^Find index (-1 if not found)
beginListIterator<T>^Get iterator

Examples

List Operations

xxml
Instantiate Collections::List<Integer>^ As <numbers> = Collections::List@Integer::Constructor();
Run numbers.add(Integer::Constructor(10));
Run numbers.add(Integer::Constructor(20));
Run numbers.add(Integer::Constructor(30));

Instantiate Integer^ As <first> = numbers.get(Integer::Constructor(0));  // 10
Instantiate Integer^ As <count> = numbers.size();  // 3

See Also