A double-ended queue.
The type of the elements in the queue.
Peek the item from the back of the deque.
The item from the back of the deque, or None if the deque is empty.
None
Peek the item from the front of the deque.
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.
Remove and return the item from the front of the deque.
Add an item to the back of the deque.
The item to add to the back of the deque.
Add an item to the front of the deque.
The item to add to the front of the deque.
Static
Create a new Deque<T> from an iterable.
Deque<T>
The iterable to create the deque from.
A new Deque<T>.
const deque = Deque.from([1, 2, 3]);deque.peekFront(); // Some(1)deque.peekBack(); // Some(3) Copy
const deque = Deque.from([1, 2, 3]);deque.peekFront(); // Some(1)deque.peekBack(); // Some(3)
A double-ended queue.