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
_getAdds a node to the end of the list.
Inserts a node after the specified 'after' node. If no 'after' node is specified, it appends it as the last node.
Optional
after: TNodeInserts a node before the specified 'before' node. If no 'before' node is specified, it inserts it as the first node.
Optional
before: TNodeIterates 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.
Takes and existing node and replaces it.
Generated using TypeDoc
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.