MPS 2023.3 Help

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 linkedlist

new priority_queue

Parameter type

Result type

Type...

sequence<? extends Type>

queue<Type>

Creates an empty queue. Optionally, initial values may be specified right in the new linked list creation expression.

queue<string> test = new linkedlist<string> {"A", "B", "C"};

Alternatively, a sequence may be specified that is used to copy elements from.

queue<Type> = new linkedlist<Type> (sequence);

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.

set.addLast (value);

removeFirst

Operand type

Parameter type

Result type

queue<Type>

Type

Removes an element from the head of the queue.

set.removeFirst (value);

first

Operand type

Parameter type

Result type

queue<Type>

Type

Retrieves the first element at the head of the queue without removing it.

set.first ();

last

Operand type

Parameter type

Result type

queue<Type>

Type

Retrieves the first element at the tail of the queue without removing it.

set.first ();

Last modified: 07 March 2024