Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T

Hierarchy

  • ILinkedList

Implemented by

Index

Methods

back

  • back(): T

clear

  • clear(): void

contains

  • contains(item: T): boolean

empty

  • empty(): boolean

filter

  • Creates a new LinkedList with all elements that pass the test implemented by the provided function.

    Parameters

    • callback: Function

      Function is a predicate, to test each element of the LinkedList. Return true to keep the element, false otherwise. It accepts two arguments: item {T} The current item being processed in the array, index {number} The index of the current element being processed in the LinkedList.

    Returns ILinkedList<T>

    A new LinkedList with the elements that pass the test. If no elements pass the test, an empty LinkedList will be returned.

find

  • find(item: T): Node<T>

forEach

  • forEach(callback: Function): void
  • Executes a provided function once for each LinkedList element.

    Parameters

    • callback: Function

      Function to execute for each element, taking four arguments: node {Node} The current Node, value {T} The current Node value, index {number} The current index in the LinkedList, LinkedList {LinkedList} The LinkedList.

    Returns void

includes

  • includes(item: T): boolean
  • Determines whether an LinkedList includes a certain element, returning true or false as appropriate.

    Parameters

    • item: T

      The item to search for.

    Returns boolean

    A boolean which is true if the value searchElement is found within the LinkedList.

indexOf

  • indexOf(item: T): number
  • Returns the first index at which a given element can be found in the LinkedList, or -1 if it is not present.

    Parameters

    • item: T

      Item to locate in the LinkedList.

    Returns number

    The first index of the element in the LinkedList; -1 if not found.

length

  • length(): number

peek

  • peek(): T

pop

  • pop(): T

push

  • push(item: T): void

remove

  • remove(item: T): T
  • Removes the first instance of an element from the LinkedList

    Parameters

    • item: T

      The element to remove from the LinkedList

    Returns T

    The removed element from the LinkedList; undefined if the LinkedList is empty.

shift

  • shift(): T

unshift

  • unshift(item: T): number

Generated using TypeDoc