| java.util.AbstractQueue
AbstractQueue | abstract public class AbstractQueue extends AbstractCollection implements Queue<E>(Code) | | An abstract class which gives out skeletal implementations for some methods
in Queue which include add, remove, and element that are based on offer,
poll, and peek except that they throw exception to indicate the occurrence of
some error instead of the return value of false or null.
< Parameters: E - >the type of the element in the collection. |
Constructor Summary | |
protected | AbstractQueue() Constructor for the sub classes. |
Method Summary | |
public boolean | add(E o) Adds an element to the queue.
Parameters: o - the element added to the queue. | public boolean | addAll(Collection<? extends E> c) Adds all the elements of a collection to the queue. | public void | clear() Removes all elements of the queue. | public E | element() Gets but not removes the element in the head of the queue. | public E | remove() Gets and removes the element in the head of the queue. |
AbstractQueue | protected AbstractQueue()(Code) | | Constructor for the sub classes.
|
add | public boolean add(E o)(Code) | | Adds an element to the queue.
Parameters: o - the element added to the queue. true if the operation succeeds. throws: NullPointerException - if the element is null. throws: IllegalStateException - if the element is not allowed to be addedto the queue. |
addAll | public boolean addAll(Collection<? extends E> c)(Code) | | Adds all the elements of a collection to the queue. If the collection is
the queue itself, then an IllegalArgumentException will be thrown out. If
during the process, some runtime exception is thrown out, then part of
the elements in the collection that have successfully added will remain
in the queue.
The result of the method is undefined if the collection is modified
during the process of the method.
Parameters: c - the collection to be added to the queue. true if the operation succeeds. throws: NullPointerException - if the collection or any element of it isnull. throws: IllegalArgumentException - If the collection to be added to thequeue is the queue itself. |
clear | public void clear()(Code) | | Removes all elements of the queue.
|
element | public E element()(Code) | | Gets but not removes the element in the head of the queue.
the element in the head of the queue. throws: NoSuchElementException - if the queue is empty. |
remove | public E remove()(Code) | | Gets and removes the element in the head of the queue.
the element in the head of the queue. throws: NoSuchElementException - if the queue is empty. |
|
|