Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Deque<T>

Generic double-ended queue.

Type parameters

  • T

    type of element to be stored on the queue.

Hierarchy

  • Deque

Index

Accessors

Methods

Accessors

length

  • get length(): number

Methods

bottom

  • bottom(): T | undefined
  • Returns T | undefined

    the element at the bottom of the deque.

pop

  • pop(): T | undefined
  • Removes and returns the element at the top of the deque.

    Returns T | undefined

    the element at the top of the deque.

push

  • push(value: T): this
  • Pushes an element to the top of the deque.

    Parameters

    • value: T

      element to be pushed.

    Returns this

shift

  • shift(): T | undefined
  • Removes and returns the element at the bottom of the deque.

    Returns T | undefined

    the element at the bottom of the deque.

top

  • top(): T | undefined
  • Returns T | undefined

    the element at the top of the deque.

unshift

  • unshift(value: T): this
  • Pushes an element to the bottom of the deque.

    Parameters

    • value: T

      element to be pushed.

    Returns this

Static from

  • from<T>(iterable: Iterable<T> | T[]): Deque<T>
  • Creates a deque from an iterable.

    Type parameters

    • T

    Parameters

    • iterable: Iterable<T> | T[]

      iterable for the elements to be added.

    Returns Deque<T>

Generated using TypeDoc