/** *
A container that stores elements, where elements are added to
* the "tail" or "back" of the queue and removed from the "head" or
* "front" of the queue. Elements are added (or "enqueued") to the
* back of the queue using the add
method, and elements
* are removed (or "dequeued") using the remove
* method. The order of removal is "first in, first out" (FIFO): the
* element that is dequeued is the element that has been stored in the
* queue the longest.
The state of a queue can be represented by the sequence of
* elements contained in the queue. For example, the state of a queue
* containing n
elements can be written as sequence
* x_1 x_2 ... x_{n-1} x_n
, where x_n
is at
* the back of the queue, and x_1
is at the front. From
* this state, enqueuing the element y
will result in a
* state x_1 x_2 ... x_{n-1} x_n y
(containing
* n+1
elements), while dequeuing from the original state
* will return the value x_1
and result in the state
* x_2 ... x_{n-1} x_n
.
Enqueue a new element x
to the back of the
* queue.
Return the element currently at the front of the queue, or
* null
if the queue is empty. The state of the queue
* is unchanged after this operation.
null
*/
E peek();
/**
* Remove and return the element at the front of the queue, if the
* queue is not empty. If the queue was previously in the state
* x_1 x_2 ... x_{n-1} x_n
with x_1
at
* the front, the resulting state will be x_2
* ... x_{n-1} x_n
and the element x_1
will be
* returned. If the queue is empty, an
* EmptyStackException
is thrown.