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

    Module Deque

    A Deque<T> is a double-ended queue that allows efficient insertion and removal at both ends. It's implemented as a doubly-linked list, making it ideal for situations where you need to add or remove elements from either end in constant time.

    Deque also implements the Iterable interface, so you can use it in a for...of loop.

    const deque = new Deque<number>();
    deque.pushBack(1);
    deque.pushBack(2);
    deque.pushFront(0);

    deque.peekBack(); // Some(2)
    deque.peekFront(); // Some(0)

    deque.popBack(); // Some(2)
    deque.popFront(); // Some(0)

    deque.popBack(); // Some(1)
    deque.popFront(); // None
    const deque = Deque.from([1, 2, 3]);
    for (const item of deque) {
    console.log(item);
    }
    // 1
    // 2
    // 3

    deque

    Deque