@returns {T|null}
()
| 123 | |
| 124 | /** @returns {T|null} */ |
| 125 | shift () { |
| 126 | const tail = this.tail |
| 127 | const next = tail.shift() |
| 128 | if (tail.isEmpty() && tail.next !== null) { |
| 129 | // If there is another queue, it forms the new tail. |
| 130 | this.tail = tail.next |
| 131 | tail.next = null |
| 132 | } |
| 133 | return next |
| 134 | } |
| 135 | } |
no test coverage detected