@binarymuse/ts-stdlib
    Preparing search index...

    Class Deque<T>

    A double-ended queue.

    Type Parameters

    • T

      The type of the elements in the queue.

    Index

    Constructors

    deque

    • Peek the item from the back of the deque.

      Returns Option<T>

      The item from the back of the deque, or None if the deque is empty.

    • Peek the item from the front of the deque.

      Returns Option<T>

      The item from the front of the deque, or None if the deque is empty.

    • Remove and return the item from the back of the deque.

      Returns Option<T>

      The item from the back of the deque, or None if the deque is empty.

    • Remove and return the item from the front of the deque.

      Returns Option<T>

      The item from the front of the deque, or None if the deque is empty.

    • Add an item to the back of the deque.

      Parameters

      • item: T

        The item to add to the back of the deque.

      Returns void

    • Add an item to the front of the deque.

      Parameters

      • item: T

        The item to add to the front of the deque.

      Returns void

    • Create a new Deque<T> from an iterable.

      Type Parameters

      • T

      Parameters

      • iterable: Iterable<T>

        The iterable to create the deque from.

      Returns Deque<T>

      A new Deque<T>.

      const deque = Deque.from([1, 2, 3]);
      deque.peekFront(); // Some(1)
      deque.peekBack(); // Some(3)