Interface: Queue<T>
A Queue to serve first-in-first-out (FIFO)
Type parameters
Name |
---|
T |
Properties
maxSize
• maxSize: number
Max size of the queue
size
• size: number
Size of the queue
Methods
dequeue
▸ dequeue(): undefined
| T
Remove the first item from the queue and return it
Returns
undefined
| T
dequeueAll
▸ dequeueAll(): T
[]
Remove all items from the queue and return them as an Array
Returns
T
[]
empty
▸ empty(): void
Empty the queue
Returns
void
enqueue
▸ enqueue(item
): number
Append the item to the end of the queue, drop when overflow
Parameters
Name | Type |
---|---|
item | T |
Returns
number
enqueueAt
▸ enqueueAt(start
, item
, replace
): number
Put the item to the |start| position of the queue, drop when overflow
Parameters
Name | Type |
---|---|
start | number |
item | T |
replace | boolean |
Returns
number