A doubly (bidirectional) linked list. Acts as a safe, value focused wrapper for a linked-node-list.

Type Parameters

  • T

Hierarchy

  • default<T>
    • default

Constructors

  • Type Parameters

    • T

    Parameters

    • Optional initialValues: null | Iterable<T>
    • equalityComparer: EqualityComparison<T> = areEqual

    Returns default<T>

Accessors

  • get firstValue(): undefined | T
  • Returns the first value or undefined if the list is empty.

    Returns undefined | T

  • get lastValue(): undefined | T
  • Returns the last value or undefined if the list is empty.

    Returns undefined | T

  • get reversed(): ExtendedIterable<T>
  • Iterable for iterating this collection in reverse order.

    Returns

    Returns ExtendedIterable<T>

  • get version(): number
  • The version number used to track changes.

    Returns

    Returns number

Methods

  • Parameters

    • item: T

    Returns boolean

  • Returns number

  • Returns Iterator<T, any, undefined>

  • Parameters

    • item: T
    • max: number = Infinity

    Returns number

  • Adds to specified item to the beginning of the list.

    Returns

    Parameters

    • item: T

    Returns default<T>

  • Throws if the provided version does not match the current one.

    Returns

    Parameters

    • version: number

    Returns true

  • Iterates the list returns the the first node that matches the value specified. Returns undefined if not found.

    Returns

    The node matching the item or undefined if not found

    Parameters

    • item: T

    Returns undefined | LinkedListNode<T>

  • Iterates the list in reverse returns the the first node that matches the value specified. Returns undefined if not found.

    Returns

    The node matching the item or undefined if not found

    Parameters

    • item: T

    Returns undefined | LinkedListNode<T>

  • Gets the number of nodes in the list.

    Returns

    Returns number

  • Iterates the list returns the the node at the index requested. Returns undefined if the index is out of range.

    Returns

    The node at the index requested or undefined.

    Parameters

    • index: number

    Returns undefined | LinkedListNode<T>

  • Iterates the list returns the value of the node at the index requested. Returns undefined if the index is out of range.

    Returns

    The value at the index requested or undefined.

    Parameters

    • index: number

    Returns undefined | T

  • Increments the collection version. Useful for tracking changes.

    Returns

    The new version.

    Returns number

  • Removes the node at the specified index.

    Returns

    True if the node was removed. False if the index was out of range.

    Parameters

    • index: number

    Returns boolean

  • Removes the first node.

    Returns

    True if the node was removed. False if the list is empty.

    Returns boolean

  • Removes the last node.

    Returns

    True if the node was removed. False if the list is empty.

    Returns boolean

  • Removes the node specified.

    Returns

    True if the node was removed. False if not found (already removed).

    Parameters

    Returns boolean

  • Iterates the list and finds the first node that matches the provided value and removes it.

    Returns

    True if found and removes, otherwise false.

    Parameters

    • item: T

      The value to remove.

    Returns boolean

  • Removes the first node and returns its value.

    Returns

    The value of the first node or undefined if the list is empty.

    Returns undefined | T

  • Removes the last node and returns its value.

    Returns

    The value of the last node or undefined if the list is empty.

    Returns undefined | T

Generated using TypeDoc