Queue

Queue

new Queue

A queue that can enqueue items at the end, and dequeue items from the front.

Members

length

The length of the queue.

Methods

clear

Remove all items from the queue.

contains

Check whether this queue contains the specified item.

Parameters:
Name Type Description
the Object item to search for.

dequeue

Dequeues an item. Returns undefined if the queue is empty.

enqueue

Enqueues the specified item.

Parameters:
Name Type Description
item Object The item to enqueue.

sort

Sort the items in the queue in-place.

Parameters:
Name Type Description
compareFunction Function a function that defines the sort order.