Skip to main content

PriorityQueue

Implementation of a PriorityQueue.

Type Parameters

T

T

Methods

add()

add(node): void

Add an element, sorted.

Parameters

node

T

Returns

void


clear()

clear(): void

Empties out the queue.

Returns

void


delete()

delete(node): void

Remove the given entry from the queue.

Parameters

node

T

Returns

void


head(): T

Get the entry with the lowest priority, or null if the queue is empty.

Returns

T


isEmpty()

isEmpty(): boolean

Returns whether or not the queue is empty.

Returns

boolean


peek()

peek(): T

Get the entry with the highest priority, and leave it in the queue.

Returns

T


pop()

pop(): T

Remove and return the last entry in the queue (the entry with the highest priority).

Returns

T


update()

update(node): void

Update the given element - meaning, remove it and re-insert it.

Parameters

node

T

Returns

void