AbstractQueue

public abstract class AbstractQueue extends AbstractCollection<E>
implements Queue<E>
Known Direct Subclasses

This class provides skeletal implementations of some Queue 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.

A Queue implementation that extends this class must minimally define a method offer(E) which does not permit insertion of null elements, along with methods peek(), poll(), size(), and iterator(). Typically, additional methods will be overridden as well. If these requirements cannot be met, consider instead subclassing AbstractCollection.

Protected Constructor Summary

AbstractQueue()
Constructor for use by subclasses.

Public Method Summary

boolean
add(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.
boolean
addAll(Collection<? extends E> c)
Adds all of the elements in the specified collection to this queue.
void
clear()
Removes all of the elements from this queue.
E
element()
Retrieves, but does not remove, the head of this queue.
E
remove()
Retrieves and removes the head of this queue.

Inherited Method Summary