Online demo
JavaDocPlus Demo | Show in full page mode
| Classic JavaDoc |
Class AbstractQueue
java.lang.Object └ java.util.AbstractCollection └ java.util.AbstractQueue
Implemented Interfaces:
Direct Known Subclasses:
public abstract class AbstractQueue extends AbstractCollection implements Queue
This class provides skeletal implementations of some
operations. The implementations in this class are appropriate when
the base implementation does not allow null
elements. Methods add, remove, and
element are based on offer, poll, and peek, respectively but throw
exceptions instead of indicating failure via false or
null returns.
Since:A Queue implementation that extends this class must minimally define a method which does not permit insertion of null elements, along with methods , , , and a supporting . Typically, additional methods will be overridden as well. If these requirements cannot be met, consider instead subclassing .
This class is a member of the Java Collections Framework.
1.5
Author:Doug Lea
Parameters: | the type of elements held in this collection |
Constructors
protected | AbstractQueue () | |
Constructor for use by subclasses. |
Methods
boolean | add (Object o) | |
Adds the specified element to this queue. This implementation returns true if offer succeeds, else throws an IllegalStateException. |
boolean | addAll (Collection c) | |
Adds all of the elements in the specified collection to this queue. Attempts to addAll of a queue to itself result in IllegalArgumentException. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress. This impl ... more > |
void | clear () | |
Removes all of the elements from this collection. The collection will be empty after this call returns. This implementation repeatedly invokes poll until it returns null. |
| element () | ||
Retrieves, but does not remove, the head of this queue. This implementation returns the result of peek unless the queue is empty. |
| remove () | ||
Retrieves and removes the head of this queue. This implementation returns the result of poll unless the queue is empty. |
Inherited methods
AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
ObjectCommunity comments
Powered by JavaDocPlus