List¶
Import: import system.collections;
Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.
insert¶
Inserts value at index, shifting later elements right. index == length appends. Returns false and leaves the list unchanged when index is outside 0 through length.
remove_at¶
Removes the element at index, shifting later elements left. Returns true on success, or false if index is out of range (the list is left unchanged in that case).
remove¶
Removes the first occurrence of value (by equality). Returns true when something was removed.
iterator¶
Enumerator for for (let x in list). Returns a fresh cursor over the current elements.
as_span¶
A view of the current elements, writable in place. The span holds the backing array it was taken from: after the list grows (or shrinks and regrows) it keeps showing that old array, so take a fresh span after structural changes.
as_read_only_span¶
A read-only view of the current elements, with the same staleness rule as as_span.
sort_by¶
Sorts the list in place with the supplied comparator.
sort¶
Sorts the list in place into ascending order using each element's compare method. Only attached when T : Comparable<T> (via where).
binary_search¶
Binary search over a list that is already sorted ascending (by compare). Returns the index of a matching element as Some(index), or None if value is not present. O(log n). Only attached when T : Comparable<T> (via where).
to_string¶
Returns a text representation of this value.