net.sf.bddbddb.order
Interface Queue

All Superinterfaces:
java.util.Collection, java.lang.Iterable
All Known Implementing Classes:
StackQueue

public interface Queue
extends java.util.Collection


Method Summary
 java.lang.Object element()
          Retrieves, but does not remove, the head of this queue.
 boolean offer(java.lang.Object o)
          Inserts the specified element into this queue, if possible.
 java.lang.Object peek()
          Retrieves, but does not remove, the head of this queue, returning null if this queue is empty.
 java.lang.Object poll()
          Retrieves and removes the head of this queue, or null if this queue is empty.
 java.lang.Object remove()
          Retrieves and removes the head of this queue.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

offer

boolean offer(java.lang.Object o)
Inserts the specified element into this queue, if possible. When using queues that may impose insertion restrictions (for example capacity bounds), method offer is generally preferable to method Collection.add(E), which can fail to insert an element only by throwing an exception.

Parameters:
o - the element to insert.
Returns:
true if it was possible to add the element to this queue, else false

poll

java.lang.Object poll()
Retrieves and removes the head of this queue, or null if this queue is empty.

Returns:
the head of this queue, or null if this queue is empty.

remove

java.lang.Object remove()
Retrieves and removes the head of this queue. This method differs from the poll method in that it throws an exception if this queue is empty.

Returns:
the head of this queue.
Throws:
java.util.NoSuchElementException - if this queue is empty.

peek

java.lang.Object peek()
Retrieves, but does not remove, the head of this queue, returning null if this queue is empty.

Returns:
the head of this queue, or null if this queue is empty.

element

java.lang.Object element()
Retrieves, but does not remove, the head of this queue. This method differs from the peek method only in that it throws an exception if this queue is empty.

Returns:
the head of this queue.
Throws:
java.util.NoSuchElementException - if this queue is empty.


Copyright © 2004-2008 Stanford SUIF Compiler Group. All Rights Reserved.