Class Deque<T>

Type Parameters

  • T

Hierarchy

Constructors

Accessors

Methods

  • The function adds a new node with a given value to the beginning of a doubly linked list.

    Parameters

    • val: T

      The val parameter represents the value of the element that you want to add to the beginning of the doubly linked list.

    Returns boolean

    A boolean value is being returned.

  • The peekFirst function returns the first node or value in a doubly linked list, depending on the specified parameter.

    Returns null | T

    The method peekFirst returns either the first node of the doubly linked list (DoublyLinkedListNode<T>), the value of the first node (T), or null depending on the value of the by parameter.

  • The peekFirst function returns the first node or value in a doubly linked list, depending on the specified parameter.

    Parameters

    • by: "val"

      The "by" parameter is an optional parameter of type DoublyLinkedListGetBy. It is used to specify whether to return the first node, the value of the first node, or the first node itself.

    Returns null | T

    The method peekFirst returns either the first node of the doubly linked list (DoublyLinkedListNode<T>), the value of the first node (T), or null depending on the value of the by parameter.

  • The peekFirst function returns the first node or value in a doubly linked list, depending on the specified parameter.

    Parameters

    • by: "node"

      The "by" parameter is an optional parameter of type DoublyLinkedListGetBy. It is used to specify whether to return the first node, the value of the first node, or the first node itself.

    Returns null | DoublyLinkedListNode<T>

    The method peekFirst returns either the first node of the doubly linked list (DoublyLinkedListNode<T>), the value of the first node (T), or null depending on the value of the by parameter.

  • The peekLast function returns the last node or value in a doubly linked list.

    Returns null | T

    The method peekLast returns the last node, value, or null based on the specified by parameter.

  • The peekLast function returns the last node or value in a doubly linked list.

    Parameters

    • by: "val"

      The "by" parameter is an optional parameter of type DoublyLinkedListGetBy. It specifies whether to return the last node, the value of the last node, or both. The default value is 'val', which means that if no value is provided for the "by" parameter, the method

    Returns null | T

    The method peekLast returns the last node, value, or null based on the specified by parameter.

  • The peekLast function returns the last node or value in a doubly linked list.

    Parameters

    • by: "node"

      The "by" parameter is an optional parameter of type DoublyLinkedListGetBy. It specifies whether to return the last node, the value of the last node, or both. The default value is 'val', which means that if no value is provided for the "by" parameter, the method

    Returns null | DoublyLinkedListNode<T>

    The method peekLast returns the last node, value, or null based on the specified by parameter.

  • The function pollFirst removes and returns the first element of a doubly linked list, either as a node or its value, depending on the specified parameter.

    Returns null | T

    The method pollFirst returns either the value of the first node in the doubly linked list, the first node itself, or null if the list is empty. The specific return type depends on the value of the by parameter. If by is set to 'node', the method returns the first node. If by is set to 'val', the method returns the value

  • The function pollFirst removes and returns the first element of a doubly linked list, either as a node or its value, depending on the specified parameter.

    Parameters

    • by: "val"

      The "by" parameter is an optional parameter of type DoublyLinkedListGetBy. It specifies the criteria by which the first element should be retrieved from the doubly linked list. The default value is 'val', which means the first element will be retrieved by its value. Other possible values for "by

    Returns null | T

    The method pollFirst returns either the value of the first node in the doubly linked list, the first node itself, or null if the list is empty. The specific return type depends on the value of the by parameter. If by is set to 'node', the method returns the first node. If by is set to 'val', the method returns the value

  • The function pollFirst removes and returns the first element of a doubly linked list, either as a node or its value, depending on the specified parameter.

    Parameters

    • by: "node"

      The "by" parameter is an optional parameter of type DoublyLinkedListGetBy. It specifies the criteria by which the first element should be retrieved from the doubly linked list. The default value is 'val', which means the first element will be retrieved by its value. Other possible values for "by

    Returns null | DoublyLinkedListNode<T>

    The method pollFirst returns either the value of the first node in the doubly linked list, the first node itself, or null if the list is empty. The specific return type depends on the value of the by parameter. If by is set to 'node', the method returns the first node. If by is set to 'val', the method returns the value

  • The function pollLast removes and returns the last element in a doubly linked list, either as a node or its value, depending on the specified parameter.

    Returns null | T

    The method pollLast returns either a DoublyLinkedListNode<T>, the value of the node (T), or null. The specific type that is returned depends on the value of the by parameter. If by is set to 'node', then a DoublyLinkedListNode<T> is returned. If by is set to `'

  • The function pollLast removes and returns the last element in a doubly linked list, either as a node or its value, depending on the specified parameter.

    Parameters

    • by: "val"

      The parameter "by" is of type DoublyLinkedListGetBy, which is an enum that can have two possible values: 'node' or 'val'. It determines the type of value that will be returned by the pollLast method. If 'node' is specified, the method will return the

    Returns null | T

    The method pollLast returns either a DoublyLinkedListNode<T>, the value of the node (T), or null. The specific type that is returned depends on the value of the by parameter. If by is set to 'node', then a DoublyLinkedListNode<T> is returned. If by is set to `'

  • The function pollLast removes and returns the last element in a doubly linked list, either as a node or its value, depending on the specified parameter.

    Parameters

    • by: "node"

      The parameter "by" is of type DoublyLinkedListGetBy, which is an enum that can have two possible values: 'node' or 'val'. It determines the type of value that will be returned by the pollLast method. If 'node' is specified, the method will return the

    Returns null | DoublyLinkedListNode<T>

    The method pollLast returns either a DoublyLinkedListNode<T>, the value of the node (T), or null. The specific type that is returned depends on the value of the by parameter. If by is set to 'node', then a DoublyLinkedListNode<T> is returned. If by is set to `'

  • The remove function removes an element at a specified index from a data structure, updating the links between nodes accordingly.

    Parameters

    • index: number

      The index parameter represents the position of the element to be removed in the data structure. It is of type number.

    Returns null | T

    The remove method returns the value of the removed element (T) if the removal is successful, or null if the index is out of bounds.

  • Updates the value of the node at the specified index. If index = 0; Value of the first element in the list is updated. If index = 3; Value of the fourth element in the list is updated.

    Parameters

    • index: number

      Index of the node to be updated

    • val: T

      New value of the node

    Returns boolean

Generated using TypeDoc