Queue
Queue
A simple queue abstraction, backed by linked list or priority queue.
Queue type
queue<Type>
| Subtypes | Supertypes | Comparable types |
|---|---|---|
| deque<Type> | sequence<Type> | java.util.Deque<Type> |
Queue creation
new linkedlistnew priority_queue
| Parameter type | Result type |
|---|---|
| Type... | queue<Type> |
Creates an empty queue. Optionally, initial values may be specified right in the new linked list creation expression.
Alternatively, a sequence may be specified that is used to copy elements from.
Operations on queue
iterator
| Operand type | Parameter type | Result type |
|---|---|---|
| sequence<Type> | none | modifying_iterator<Type> |
This operation is redefined for queue to return a modifying_iterator .
addLast
| Operand type | Parameter type | Result type |
|---|---|---|
| queue<Type> | Type | Type |
Appends an element to the tail of the queue.
removeFirst
| Operand type | Parameter type | Result type |
|---|---|---|
| queue<Type> |
| Type |
Removes an element from the head of the queue.
first
| Operand type | Parameter type | Result type |
|---|---|---|
| queue<Type> |
| Type |
Retrieves the first element at the head of the queue without removing it.
last
| Operand type | Parameter type | Result type |
|---|---|---|
| queue<Type> |
| Type |
Retrieves the first element at the tail of the queue without removing it.