The node type.
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
_Erases the linked node's references to each other and returns the number of nodes.
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.
Iterates the list to find the specified node and returns its index.
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).
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 is useful for managing a list of linked nodes, but it does not protect against modifying individual links. If the consumer modifies a link (sets the previous or next value) it will effectively break the collection.
It is possible to declare a node type of any kind as long as it contains a previous and next value that can reference another node. Although not as safe as a protected LinkedList, this class has less overhead and is more flexible.
The count (or length) of this
LinkedNodeList
is tracked as.unsafeCount
and calling.getCount()
will iterate the list.