Returns the first node or undefined if the collection is empty.
The first node or undefined.
Returns last node or be undefined if the collection is empty.
The last node or undefined.
Iterable for iterating this collection in reverse order.
Returns the tracked number of nodes in the list.
Since a LinkedNodeList
is unprotected, it is possible to modify the chain and this count could get out of sync.
To know the actual number of nodes, call .getCount()
to iterate over each node.
Protected
_Inserts a node after the specified 'after' node. If no 'after' node is specified, it appends it as the last node.
Optional
after: LinkedNodeWithValue<T>Inserts a node before the specified 'before' node. If no 'before' node is specified, it inserts it as the first node.
Optional
before: LinkedNodeWithValue<T>Adds a node with the given value to the end of the list. Becomes the last node.
Erases the linked node's references to each other and returns the number of nodes.
Copies the values of each node to an array (or array-like object).
The target array.
The starting index of the target array.
The target array.
Clears the list. Provided for use with dispose helpers.
Iterates the list to find the specific node that matches the predicate condition.
The found node or undefined.
Iterates the list returns the node at the index requested. Returns undefined if the index is out of range.
The node at the index requested or undefined.
Returns an iterable that selects the value of each node.
Iterates the list to find the specified node and returns its index.
Adds a node with the given value to the start of the list. Becomes the first node.
Clears the list. Provided for use with object pools.
Removes the first node and returns true if successful.
Removes the last node and returns true if successful.
Removes the specified node. Returns true if successful and false if not found (already removed).
Takes and existing node and replaces it.
Removes the first node and returns it if successful. Returns undefined if the collection is empty.
The node that was removed, or undefined if the collection is empty.
Removes the last node and returns it if successful. Returns undefined if the collection is empty.
The node that was removed, or undefined if the collection is empty.
This class covers most LinkedNodeList use cases by assuming the node type includes a '.value' property.