11766e4e9109dc4356be0a4b589ee5e5ed9b7bd3
4 export class Queue
<T
> {
5 private items
: Record
<number, T
>
9 public constructor () {
15 public get
size (): number {
16 return this.tail
- this.head
19 public enqueue (item
: T
): number {
20 this.items
[this.tail
] = item
25 public dequeue (): T
| undefined {
26 if (this.size
<= 0) return undefined
27 const item
= this.items
[this.head
]
28 // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
29 delete this.items
[this.head
]
31 if (this.head
=== this.tail
) {