net.datastructures
Interface Queue<E>

All Known Implementing Classes:
NodeQueue

public interface Queue<E>

Interface for a queue: a collection of elements that are inserted and removed according to the first-in first-out principle.

Author:
Michael T. Goodrich, Natasha Gelfand, Mark Handy, Roberto Tamassia
See Also:
EmptyQueueException

Method Summary
 E dequeue()
          Removes the element at the front of the queue.
 void enqueue(E element)
          Inserts an element at the rear of the queue.
 E front()
          Inspects the element at the front of the queue.
 boolean isEmpty()
          Returns whether the queue is empty.
 int size()
          Returns the number of elements in the queue.
 

Method Detail

size

int size()
Returns the number of elements in the queue.

Returns:
number of elements in the queue.

isEmpty

boolean isEmpty()
Returns whether the queue is empty.

Returns:
true if the queue is empty, false otherwise.

front

E front()
        throws EmptyQueueException
Inspects the element at the front of the queue.

Returns:
element at the front of the queue.
Throws:
EmptyQueueException - if the queue is empty.

enqueue

void enqueue(E element)
Inserts an element at the rear of the queue.

Parameters:
element - new element to be inserted.

dequeue

E dequeue()
          throws EmptyQueueException
Removes the element at the front of the queue.

Returns:
element removed.
Throws:
EmptyQueueException - if the queue is empty.