11 |
|
|
12 |
|
/** |
13 |
|
* An unbounded {@linkplain BlockingQueue blocking queue} based on a |
14 |
< |
* {@link PriorityQueue}, |
15 |
< |
* obeying its ordering rules and implementation characteristics. |
16 |
< |
* While this queue is logically unbounded, |
17 |
< |
* attempted additions may fail due to resource exhaustion (causing |
18 |
< |
* <tt>OutOfMemoryError</tt>). |
14 |
> |
* {@link PriorityQueue}, obeying its ordering rules and |
15 |
> |
* implementation characteristics. While this queue is logically |
16 |
> |
* unbounded, attempted additions may fail due to resource exhaustion |
17 |
> |
* (causing <tt>OutOfMemoryError</tt>). A priority queue does not |
18 |
> |
* permit <tt>null</tt> elements. A priority queue relying on natural |
19 |
> |
* ordering also does not permit insertion of non-comparable objects |
20 |
> |
* (doing so results in <tt>ClassCastException</tt>). |
21 |
|
* |
22 |
|
* <p>This class implements all of the <em>optional</em> methods |
23 |
|
* of the {@link Collection} and {@link Iterator} interfaces. |
119 |
|
} |
120 |
|
|
121 |
|
/** |
120 |
– |
* Adds all of the elements in the specified collection to this queue. |
121 |
– |
* The behavior of this operation is undefined if |
122 |
– |
* the specified collection is modified while the operation is in |
123 |
– |
* progress. (This implies that the behavior of this call is undefined if |
124 |
– |
* the specified collection is this queue, and this queue is nonempty.) |
125 |
– |
* <p> |
126 |
– |
* This implementation iterates over the specified collection, and adds |
127 |
– |
* each object returned by the iterator to this collection, in turn. |
128 |
– |
* @param c collection whose elements are to be added to this queue |
129 |
– |
* @return <tt>true</tt> if this queue changed as a result of the |
130 |
– |
* call. |
131 |
– |
* @throws NullPointerException if <tt>c</tt> or any element in <tt>c</tt> |
132 |
– |
* is <tt>null</tt> |
133 |
– |
* @throws ClassCastException if any element cannot be compared |
134 |
– |
* with elements currently in the priority queue according |
135 |
– |
* to the priority queue's ordering. |
136 |
– |
*/ |
137 |
– |
public boolean addAll(Collection<? extends E> c) { |
138 |
– |
return super.addAll(c); |
139 |
– |
} |
140 |
– |
|
141 |
– |
/** |
122 |
|
* Returns the comparator used to order this collection, or <tt>null</tt> |
123 |
|
* if this collection is sorted according to its elements natural ordering |
124 |
|
* (using <tt>Comparable</tt>). |
131 |
|
} |
132 |
|
|
133 |
|
/** |
134 |
< |
* Inserts the specified element to this priority queue. |
134 |
> |
* Inserts the specified element into this priority queue. |
135 |
|
* |
136 |
|
* @param o the element to add |
137 |
|
* @return <tt>true</tt> |
167 |
|
} |
168 |
|
|
169 |
|
/** |
170 |
< |
* Adds the specified element to this priority queue. As the queue is |
170 |
> |
* Inserts the specified element into this priority queue. As the queue is |
171 |
|
* unbounded this method will never block. |
172 |
|
* @param o the element to add |
173 |
|
* @param timeout This parameter is ignored as the method never blocks |