Class ArrayDeque<T>

Type Parameters

  • T

Hierarchy

  • ArrayDeque

Constructors

Properties

_nodes: T[] = []

Accessors

Methods

  • The get function returns the element at the specified index in an array, or null if the index is out of bounds.

    Parameters

    • index: number

      The index parameter is a number that represents the position of the element you want to retrieve from the array.

    Returns null | T

    The method is returning the element at the specified index in the _nodes array. If the element exists, it will be returned. If the element does not exist (i.e., the index is out of bounds), null will be returned.

  • The insert function adds a value at a specified index in an array.

    Parameters

    • index: number

      The index parameter specifies the position at which the value should be inserted in the array. It is a number that represents the index of the array where the value should be inserted. The index starts from 0, so the first element of the array has an index of 0, the second element has

    • value: T

      The value parameter represents the value that you want to insert into the array at the specified index.

    Returns T[]

    The splice method returns an array containing the removed elements, if any. In this case, since no elements are being removed, an empty array will be returned.

  • The function checks if an array called "_nodes" is empty.

    Returns boolean

    The method isEmpty() is returning a boolean value. It returns true if the length of the _nodes array is 0, indicating that the array is empty. Otherwise, it returns false.

  • The function "offerFirst" adds a value to the beginning of an array.

    Parameters

    • value: T

      The value parameter represents the value that you want to add to the beginning of the array.

    Returns number

    The return value of the offerFirst function is the new length of the array _nodes after adding the value at the beginning.

  • The function "offerLast" adds a value to the end of an array.

    Parameters

    • value: T

      The value parameter represents the value that you want to add to the end of the array.

    Returns number

    The return value is the new length of the array after the value has been added.

  • The peekFirst function returns the first element of an array or null if the array is empty.

    Returns null | T

    The function peekFirst() is returning the first element (T) of the _nodes array. If the array is empty, it will return null.

  • The peekLast function returns the last element of an array or null if the array is empty.

    Returns null | T

    The method peekLast() returns the last element of the _nodes array, or null if the array is empty.

  • The pollFirst function removes and returns the first element from an array, or returns null if the array is empty.

    Returns null | T

    The pollFirst() function returns the first element of the _nodes array, or null if the array is empty.

  • The function "pollLast" returns and removes the last element from an array, or returns null if the array is empty.

    Returns null | T

    The method pollLast() returns the last element of the _nodes array, or null if the array is empty.

  • The remove function removes an element from an array at a specified index.

    Parameters

    • index: number

      The index parameter specifies the position of the element to be removed from the array. It is a number that represents the index of the element to be removed.

    Returns T[]

    The method is returning an array containing the removed element.

  • The set function assigns a value to a specific index in an array.

    Parameters

    • index: number

      The index parameter is a number that represents the position of the element in the array that you want to set a new value for.

    • value: T

      The value parameter represents the new value that you want to set at the specified index in the _nodes array.

    Returns T

    The value that is being set at the specified index in the _nodes array.

Generated using TypeDoc