a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / CircularQueue
CircularQueue is a data structure that follows the First In First Out (FIFO) principle and efficiently manages queue operations within a fixed, circular buffer.
• T
The type of elements held in the queue.
new CircularQueue<
T
>(capacity
):CircularQueue
<T
>
• capacity: number
shared/ds/queue/CircularQueue.ts:16
dequeue():
T
Removes and returns the front element from the queue. If the queue is empty, returns undefined.
T
The front element of the queue if it exists, otherwise undefined.
shared/ds/queue/CircularQueue.ts:46
enqueue(
item
):void
Adds an item to the end of the queue.
• item: T
The item to be added to the queue.
void
Does not return a value.
shared/ds/queue/CircularQueue.ts:30
isEmpty():
boolean
Checks if the collection is empty.
boolean
true if the collection has no elements; otherwise, false.
shared/ds/queue/CircularQueue.ts:76
isFull():
boolean
Checks if the current container is full.
boolean
Returns true if the container is full, otherwise false.
shared/ds/queue/CircularQueue.ts:85
peek():
T
Retrieves, but does not remove, the front element of the queue.
T
The front element of the queue if present, otherwise undefined.
shared/ds/queue/CircularQueue.ts:63
size():
number
Gets the current size or count of elements.
number
The number of elements.