Class: Queue

Queue()

The Queue class extends Collection and acts as a
template for defining essential methods that every sorted collection should implement:

Abstract Methods:

Concrete Methods:
Based on the abstract methods, these are inherited by all subclasses
of sorted collections:

Constructor

new Queue()

Source:

Classes

Queue

Methods

peek(firstopt) → {any}

Retrieves the first item of this Queue.

Parameters:
Name Type Attributes Default Description
first boolean <optional>
true

If false, retrieves the last item instead.

Source:
Returns:

The retrieved item.

Type
any

poll(firstopt) → {any}

Extracts (removes and returns) the first item of this Queue.

Parameters:
Name Type Attributes Default Description
first boolean <optional>
true

If false, extracts the last item instead.

Source:
Returns:

The extracted item.

Type
any

reverse() → {Each.<any>}

Provides an iterable reversed view of this Queue.

Source:
Returns:

An iterable over the queue's elements in reverse order.

Type
Each.<any>

select(n, firstopt) → {Array.<any>}

Selects and keeps the first n items of the queue, removing all other items.

Parameters:
Name Type Attributes Default Description
n number

Number of items to keep in the queue

first boolean <optional>
true

If true, selects items from the start; if false, from the end.

Source:
Returns:

An array containing the discarded items removed from the queue.

Type
Array.<any>