LinkedListCursor
Defined in: packages/data/src/list/linked-list.ts:37
A cursor over a LinkedList.
Forward-only, matching what a singly-linked list can honour in O(1): there is
no retreat, and insertAfter/removeAfter operate on the node this cursor
points at without walking the list from the head.
A cursor’s element was removed — by any means, not just through this cursor —
is exactly when valid becomes false; the underlying node is marked on
removal, and every cursor still referencing it observes that mark. A cursor
obtained from end() has no node of its own: insertAfter on it appends,
reading the list’s current tail live, so it never goes stale even if other
insertions/removals happen first.
Type Parameters
Section titled “Type Parameters”T extends DefinedValue
The type of elements in the list.
Implements
Section titled “Implements”ICursor<T>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LinkedListCursor<
T>(list,node):LinkedListCursor<T>
Defined in: packages/data/src/list/linked-list.ts:38
Parameters
Section titled “Parameters”LinkedList<T>
LinkedListNode_<T> | null
Returns
Section titled “Returns”LinkedListCursor<T>
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get valid():
boolean
Defined in: packages/data/src/list/linked-list.ts:43
False once moved past the end, or once its element was removed.
Returns
Section titled “Returns”boolean
False once moved past the end, or once its element was removed.
Implementation of
Section titled “Implementation of”Get Signature
Section titled “Get Signature”get value():
T|undefined
Defined in: packages/data/src/list/linked-list.ts:47
The element at this position, undefined when not valid.
Returns
Section titled “Returns”T | undefined
The element at this position, undefined when not valid.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”advance()
Section titled “advance()”advance():
boolean
Defined in: packages/data/src/list/linked-list.ts:51
Moves one position forward.
Returns
Section titled “Returns”boolean
false if that moved past the end.
Implementation of
Section titled “Implementation of”clone()
Section titled “clone()”clone():
LinkedListCursor<T>
Defined in: packages/data/src/list/linked-list.ts:60
An independent cursor at the same position.
Returns
Section titled “Returns”LinkedListCursor<T>