Queue
A Queue to serve first-in-first-out (FIFO)
Type Parameters
| Type Parameter |
|---|
T |
Properties
| Property | Type | Description |
|---|---|---|
maxSize | number | Max size of the queue |
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
| Parameter | 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
| Parameter | Type |
|---|---|
start | number |
item | T |
replace | boolean |
Returns
number