1 *java.util.AbstractQueue* *AbstractQueue* This class provides skeletal implement
3 public abstract class AbstractQueue
4 extends |java.util.AbstractCollection|
5 implements |java.util.Queue|
7 |java.util.AbstractQueue_Description|
8 |java.util.AbstractQueue_Fields|
9 |java.util.AbstractQueue_Constructors|
10 |java.util.AbstractQueue_Methods|
12 ================================================================================
14 *java.util.AbstractQueue_Constructors*
15 |java.util.AbstractQueue()|Constructor for use by subclasses.
17 *java.util.AbstractQueue_Methods*
18 |java.util.AbstractQueue.add(E)|Adds the specified element to this queue.
19 |java.util.AbstractQueue.addAll(Collection)|Adds all of the elements in the spe
20 |java.util.AbstractQueue.clear()|Removes all of the elements from this collecti
21 |java.util.AbstractQueue.element()|Retrieves, but does not remove, the head of
22 |java.util.AbstractQueue.remove()|Retrieves and removes the head of this queue.
24 *java.util.AbstractQueue_Description*
26 This class provides skeletal implementations of some (|java.util.Queue|)
27 operations. The implementations in this class are appropriate when the base
28 implementation does not allow null elements. Methods
29 add(|java.util.AbstractQueue|) , remove(|java.util.AbstractQueue|) , and
30 element(|java.util.AbstractQueue|) are based on
31 offer(|java.util.AbstractQueue|) , poll(|java.util.AbstractQueue|) , and
32 peek(|java.util.AbstractQueue|) , respectively but throw exceptions instead of
33 indicating failure via false or null returns.
35 A Queue implementation that extends this class must minimally define a method
36 (|java.util.Queue|) which does not permit insertion of null elements, along
37 with methods (|java.util.Queue|) , (|java.util.Queue|) ,
38 (|java.util.Collection|) , and a (|java.util.Collection|) supporting
39 (|java.util.Iterator|) . Typically, additional methods will be overridden as
40 well. If these requirements cannot be met, consider instead subclassing
41 (|java.util.AbstractCollection|) .
43 This class is a member of the <a href="/../guide/collections/index.html"> Java
44 Collections Framework.
47 *java.util.AbstractQueue()*
49 protected AbstractQueue()
51 Constructor for use by subclasses.
54 *java.util.AbstractQueue.add(E)*
56 public boolean add(java.lang.Object o)
58 Adds the specified element to this queue. This implementation returns true if
59 offer succeeds, else throws an IllegalStateException.
63 Returns: true (as per the general contract of Collection.add).
64 *java.util.AbstractQueue.addAll(Collection)*
66 public boolean addAll(java.util.Collection c)
68 Adds all of the elements in the specified collection to this queue. Attempts to
69 addAll of a queue to itself result in IllegalArgumentException. Further, the
70 behavior of this operation is undefined if the specified collection is modified
71 while the operation is in progress.
73 This implementation iterates over the specified collection, and adds each
74 element returned by the iterator to this collection, in turn. A runtime
75 exception encountered while trying to add an element (including, in particular,
76 a null element) may result in only some of the elements having been
77 successfully added when the associated exception is thrown.
79 c - collection whose elements are to be added to this collection.
81 Returns: true if this collection changed as a result of the call.
82 *java.util.AbstractQueue.clear()*
86 Removes all of the elements from this collection. The collection will be empty
87 after this call returns. This implementation repeatedly invokes
88 poll(|java.util.AbstractQueue|) until it returns null.
91 *java.util.AbstractQueue.element()*
93 public |java.lang.Object| element()
95 Retrieves, but does not remove, the head of this queue. This implementation
96 returns the result of peek unless the queue is empty.
99 Returns: the head of this queue.
100 *java.util.AbstractQueue.remove()*
102 public |java.lang.Object| remove()
104 Retrieves and removes the head of this queue. This implementation returns the
105 result of poll unless the queue is empty.
108 Returns: the head of this queue.