The goog.structs.Queue Class

goog.structs.Queue()

Class for FIFO Queue data structure.

.clear()

Removes all elements from the queue.

.contains(obj)

Returns true if the given value is in the queue.

obj {*}
The value to look for.
returns {boolean}
Whether the object is in the queue.

.dequeue()

Retrieves and removes the head of this queue.

returns {*}
The element at the head of this queue. Returns undefined if the queue is empty.

.enqueue(element)

Puts the specified element on this queue.

element {*}
The element to be added to the queue.

.getCount()

Returns the number of elements in this queue.

returns {number}
The number of elements in this queue.

.getValues()

Returns all the values in the queue.

returns {Array}
An array of the values in the queue.

.isEmpty()

Returns true if this queue contains no elements.

returns {boolean}
true if this queue contains no elements.

.peek()

Retrieves but does not remove the head of this queue.

returns {*}
The element at the head of this queue. Returns undefined if the queue is empty.

.remove(obj)

Removes the first occurrence of a particular value from the queue.

obj {*}
Object to remove.
returns {boolean}
True if an element was removed.