Private
itemsPrivate
frontPrivate
backmaximum length of the queue.
pushing more items than the length will remove the items from the opposite side, so as to maintain the size
iterate over the items in this deque, starting from the rear-most item, and ending at the front-most item
inserts one or more items to the back of the deque.
if the deque is full, it will remove the front item before adding a new item
Rest
...items: T[]inserts one or more items to the front of the deque.
if the deque is full, it will remove the rear item before adding a new item
Rest
...items: T[]Private
resolveprovide an index with relative to this.back + 1
, and get the appropriate resolved index i
that can be used to retrieve this.items[i]
.
example: this.items[this.resolveIndex(0)] === "rear most element of the deque"
example: this.items[this.resolveIndex(5)] === "fifth element ahead of the rear of the deque"
replaces the item at the specified index with a new item.
inserts an item at the specified index, shifting all items ahead of it one position to the front.
if the deque is full, it removes the front item before adding the new item.
Generated using TypeDoc
a double-ended circular queue, similar to python's
collection.deque