Copyright 2002 by aragost

com.aragost.util
Interface Queue

All Superinterfaces:
java.util.Collection
All Known Implementing Classes:
FifoQueue, LifoQueue

public interface Queue
extends java.util.Collection

A general queue interface. A queue is a data structure that support add and remove. The implementation decide the semantic of the remove (i.e. what element is removed) Two typically implementations are LIFO and FIFO.


Method Summary
 boolean add(java.lang.Object obj)
          Add the specified Object to the queue.
 java.lang.Object peek()
          Return the next Object from the queue, that is the Object that will be returned by the remove method.
 java.lang.Object remove()
          Remove the next Object from the queue.
 
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

add

public boolean add(java.lang.Object obj)
Add the specified Object to the queue.

Specified by:
add in interface java.util.Collection
Parameters:
obj - The Object to add to the queue
Returns:
true (defined like that in Collection)

remove

public java.lang.Object remove()
Remove the next Object from the queue. If the queue is empty then throw an NoSuchElementException.

Returns:
Return the Object removed.

peek

public java.lang.Object peek()
                      throws java.lang.UnsupportedOperationException
Return the next Object from the queue, that is the Object that will be returned by the remove method. This method is optional, if it is not supported an UnsupportedOperationException should be thrown.

java.lang.UnsupportedOperationException

Copyright 2002 by aragost