All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Interface structure.Queue

public interface Queue
extends Linear
A first-in, first-out structure. Values are added at the tail, and removed from the head. Used to process values in the order that they appear.

See Also:
Stack

Method Index

 o add(Object)
Add a value to the tail of the queue.
 o dequeue()
Remove a value from the head of the queue.
 o enqueue(Object)
Add a value to the tail of the queue.
 o peek()
Fetch the value at the head of the queue.
 o remove()
Remove a value form the head of the queue.

Methods

 o add
public abstract void add(Object value)
Add a value to the tail of the queue.

Postcondition:
the value is added to the tail of the structure

Parameters:
value - The value added.
See Also:
enqueue
 o enqueue
public abstract void enqueue(Object value)
Add a value to the tail of the queue.

Postcondition:
the value is added to the tail of the structure

Parameters:
value - The value to be added.
 o remove
public abstract Object remove()
Remove a value form the head of the queue.

Precondition:
the queue is not empty
Postcondition:
the head of the queue is removed and returned

Returns:
The value actually removed.
See Also:
dequeue
 o dequeue
public abstract Object dequeue()
Remove a value from the head of the queue.

Precondition:
the queue is not empty
Postcondition:
the head of the queue is removed and returned

Returns:
The value removed from the queue.
 o peek
public abstract Object peek()
Fetch the value at the head of the queue.

Precondition:
the queue is not empty
Postcondition:
the element at the head of the queue is returned

Returns:
Reference to the first value of the queue.

All Packages  Class Hierarchy  This Package  Previous  Next  Index