Class LinkedList<T>

A generic doubly-linked list.

Type Parameters

  • T

Hierarchy

  • LinkedList

Implements

Constructors

Properties

_first: null | LinkedListNode<T> = null
_last: null | LinkedListNode<T> = null
_size: number = 0

Accessors

Methods

  • Create an iterator over the values in the list.

    Returns IterableIterator<T>

    A new iterator starting with the first value.

    Complexity

    Constant.

  • Insert a value after a specific node in the list.

    Parameters

    • value: T

      The value to insert after the reference node.

    • ref: null | INode<T>

      The reference node of interest. If this is null, the value will be added to the end of the list.

    Returns INode<T>

    The list node which holds the value.

    Notes

    The reference node must be owned by the list.

    Complexity

    Constant.

  • Insert a value before a specific node in the list.

    Parameters

    • value: T

      The value to insert before the reference node.

    • ref: null | INode<T>

      The reference node of interest. If this is null, the value will be added to the beginning of the list.

    Returns INode<T>

    The list node which holds the value.

    Notes

    The reference node must be owned by the list.

    Complexity

    Constant.

Generated using TypeDoc