Skip to content

Std collections list

std:std.collections.List

Class List Implements IContainer#

The List class provides support for linked lists.

A linked list is a container style data structure that provides efficient support for the addition, removal and sequential traversal of objects.

A linked list works by connecting elements together with 'next' and 'previous' references, making it very efficient to get from one element to the next, but not so efficient for accessing arbitrary elements.

This connection between elements is achieved using separate Node objects (there is one per element) which contain references to the next and previous nodes in the list, as well as the actual object managed by the node.

Lists implements the IContainer interface so can be used with Eachin loops.

Structs
BackwardsIterator The List.BackwardsIterator struct.
Iterator The List.Iterator struct.
Classes
Node The List.Node class.
Constructors
New Creates a new list.
Properties
Empty Checks whether the list is empty. (read only)
First Gets the first value in the list. (read only)
Last Gets the last value in the list (read only)
Methods
Add Adds a value to the end of the list.
AddAll Adds all values in an array or container to the end of the list.
AddFirst Adds a value to the start of the list.
AddLast Adds a value to the end of the list.
All Gets an iterator for visiting list values.
Backwards Gets an iterator for visiting list values in reverse order.
Clear Removes all values from the list.
Count Counts the number of values in the list.
FindLastNode Finds the last node in the list containing a value.
FindNode Finds the first node in the list containing a value.
FirstNode Gets the first node in the list.
HeadNode Gets the head node of the list.
Join Joins the values in the string list.
LastNode Gets the last node in the list.
Remove Removes the first value in the list equal to a given value.
RemoveEach Removes all values in the list equal to a given value.
RemoveFirst Removes and returns the first value in the list.
RemoveIf Removes all values in the list that fulfill a condition.
RemoveLast Removes the last value in the list equal to a given value.
Sort Sorts the list.
ToArray Converts the list to an array.