The type of elements in the deque.
Readonly
capacityThe maximum number of elements the collection can hold.
If the collection is unbounded, this will be Infinity
.
Protected
Readonly
dataReturns the item at the back of the deque without removing it.
The item at the back of the deque, or undefined
if the deque is empty.
Removes all elements from the collection.
Returns the number of elements in the collection.
Returns the item at the front of the deque without removing it.
The item at the front of the deque, or undefined
if the deque is empty.
Removes and returns the item at the back of the deque.
The item at the back of the deque, or undefined
if the deque is empty.
Adds one or more items to the back of the deque.
The items are added in the order they are provided, with the last item in the argument list becoming the new back of the deque.
The items to add to the back of the deque.
Replaces the first occurence of the item matching the given predicate in the collection with a new item.
true
if the item was found and replaced, false
otherwise.
Removes and returns the item at the front of the deque.
The item at the front of the deque, or undefined
if the deque is empty.
Adds one or more items to the front of the deque.
The items are added in the order they are provided, with the last item in the argument list becoming the new front of the deque.
The items to add to the front of the deque.
Same as push
, but waits for capacity if the operation would exceed it.
Optional
signal: null | AbortSignalOptional abort signal to cancel the operation.
Same as unshift
, but waits for capacity if the operation would exceed it.
Optional
signal: null | AbortSignalOptional abort signal to cancel the operation.
A double-ended queue (deque) implementation.