Queue<E> Interface
A Queue is a collection that can be manipulated at both ends. One
can iterate over the elements of a queue through forEach
or with
an Iterator.
Default class
Extends
Implemented by
Constructors
Code new Queue.from(Iterable<E> other) #
Creates a queue with the elements of other. The order in the queue will be the order provided by the iterator of other.
Queue.from(Iterable<E> other);
Code new Queue() #
Creates a queue.
Queue();
Methods
Code void addAll(Collection<E> collection) #
Adds all elements of collection at the end of the queue. The length of the queue is extended by the length of collection.
void addAll(Collection<E> collection);
Code void clear() #
Removes all elements in the queue. The size of the queue becomes zero.
void clear();
Code E first() #
Returns the first element of the queue. Throws an EmptyQueueException exception if this queue is empty.
E first();
Code E last() #
Returns the last element of the queue. Throws an EmptyQueueException exception if this queue is empty.
E last();
Code E removeFirst() #
Removes and returns the first element of this queue. Throws an EmptyQueueException exception if this queue is empty.
E removeFirst();
Code E removeLast() #
Removes and returns the last element of the queue. Throws an EmptyQueueException exception if this queue is empty.
E removeLast();