All Packages Class Hierarchy This Package Previous Next Index
Interface jdsl.simple.api.Queue
- public interface Queue
Interface for a queue. A queue is a collection of elements that
are inserted and removed according to the first-in first-out
principle.
- Version:
- $Revision: 1.2 $, $Date: 1998/07/02 21:24:43 $
- Author:
- Michael T. Goodrich, Natasha Gelfand, Mark Handy, Roberto Tamassia
- See Also:
- QueueEmptyException, Stack, Deque
-
dequeue()
-
Remove the element at the front.
-
enqueue(Object)
-
Insert an element at the rear.
-
front()
- Inspect the element at the front, without removing it or
otherwise changing the queue.
-
isEmpty()
-
Return true if and only if the queue is empty.
-
size()
-
Return the number of elements.
size
public abstract int size()
- Return the number of elements.
- Returns:
- number of elements in the queue.
isEmpty
public abstract boolean isEmpty()
- Return true if and only if the queue is empty.
- Returns:
- true if the queue is empty, false otherwise.
front
public abstract Object front() throws QueueEmptyException
- Inspect the element at the front, without removing it or
otherwise changing the queue.
- Returns:
- element at the front of the queue
- Throws: QueueEmptyException
- if the queue is empty
enqueue
public abstract void enqueue(Object element)
- Insert an element at the rear.
- Parameters:
- element - new element to be inserted.
dequeue
public abstract Object dequeue() throws QueueEmptyException
- Remove the element at the front.
- Returns:
- element removed.
All Packages Class Hierarchy This Package Previous Next Index