* Prepend an item to the head. O(1) amortized.
(item)
| 44 | * Prepend an item to the head. O(1) amortized. |
| 45 | */ |
| 46 | unshift(item) { |
| 47 | if (this.#size > this.#mask) { |
| 48 | this.#grow(); |
| 49 | } |
| 50 | this.#head = (this.#head - 1 + this.#mask + 1) & this.#mask; |
| 51 | this.#backing[this.#head] = item; |
| 52 | this.#size++; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Remove and return the item at the head. O(1). |
no test coverage detected