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 / PriorityQueue
PriorityQueue is a data structure that manages elements in a way that the element with the highest priority is always dequeued first. Elements are stored with an associated priority, and the element with the lowest numerical priority value is considered the highest priority.
• T
The type of elements held in the PriorityQueue.
new PriorityQueue<
T
>():PriorityQueue
<T
>
dequeue():
T
Removes and returns the first element from the queue. If the queue is empty, it returns undefined.
T
The first element in the queue or undefined if the queue is empty.
shared/ds/queue/PriorityQueue.ts:44
enqueue(
item
,priority
):void
Adds an item to the queue with a specified priority.
• item: T
The item to be added to the queue.
• priority: number
The priority of the item.
void
shared/ds/queue/PriorityQueue.ts:21
isEmpty():
boolean
Checks if the collection is empty.
boolean
True if the collection is empty, false otherwise.
shared/ds/queue/PriorityQueue.ts:62
peek():
T
Returns the first element in the collection without removing it.
T
The value of the first element, or undefined if the collection is empty.
shared/ds/queue/PriorityQueue.ts:53
size():
number
Gets the number of elements.
number
The number of elements.