List[T]

typeList[T]

A growable array.

methodcapacity(self: List[T]) → u64

Returns the capacity of the current allocation of this list.

methodconcat(self: List[T], other: List[T]) → List[T]

Concatenate this list with another, returning the result.

The arguments are not mutated by this function.

methodcontains(self: List[T], item: T) → bool

Returns true if this list contains the given item, and false otherwise.

methodget(self: List[T], idx: u64) → Option[T]

Get an element from the list.

This function returns None if the index is out of bounds.

methodindex(self: List[T], item: T) → Option[u64]

Returns the index of the first occurrence of the given item in this list, or None if the item is not found.

methodis_empty(self: List[T]) → bool

Returns whether is list is empty.

methodjoin(self: List[String], separator: String) → String

Join the strings in a list into a single string.

methodlen(self: List[T]) → u64

Returns the length of this list.

methodnew() → List[T]

Create a new empty list.

methodpush(self: List[T], elem: T)

Append an element to the end of this list.

methodset(self: List[T], idx: u64, elem: T) → bool

Replace the element at the given index in this list.

Returns false if the index is out of bounds.

methodswap(self: List[T], i: u64, j: u64)

Swap two elements in this list at the given indices.

This function does nothing if either i or j is out of bounds.