166 |
|
} |
167 |
|
|
168 |
|
/** |
169 |
< |
* Create a <tt>LinkedBlockingQueue</tt> with a capacity if |
169 |
> |
* Create a <tt>LinkedBlockingQueue</tt> with a capacity of |
170 |
|
* {@link Integer#MAX_VALUE}, initially holding the elements of the |
171 |
|
* given collection, |
172 |
|
* added in traversal order of the collection's iterator. |
173 |
< |
* @param initialElements the elements to initially contain |
173 |
> |
* @param c the collection of elements to initially contain |
174 |
> |
* @throws NullPointerException if <tt>c</tt> or any element within it |
175 |
> |
* is <tt>null</tt> |
176 |
|
*/ |
177 |
< |
public LinkedBlockingQueue(Collection<E> initialElements) { |
177 |
> |
public LinkedBlockingQueue(Collection<E> c) { |
178 |
|
this(Integer.MAX_VALUE); |
179 |
< |
for (Iterator<E> it = initialElements.iterator(); it.hasNext();) |
179 |
> |
for (Iterator<E> it = c.iterator(); it.hasNext();) |
180 |
|
add(it.next()); |
181 |
|
} |
182 |
|
|
183 |
+ |
|
184 |
+ |
// Have to override just to update the javadoc for @throws |
185 |
+ |
|
186 |
+ |
/** |
187 |
+ |
* @throws IllegalStateException {@inheritDoc} |
188 |
+ |
* @throws NullPointerException {@inheritDoc} |
189 |
+ |
*/ |
190 |
+ |
public boolean add(E o) { |
191 |
+ |
return super.add(o); |
192 |
+ |
} |
193 |
+ |
|
194 |
+ |
/** |
195 |
+ |
* @throws IllegalStateException {@inheritDoc} |
196 |
+ |
* @throws NullPointerException {@inheritDoc} |
197 |
+ |
*/ |
198 |
+ |
public boolean addAll(Collection<? extends E> c) { |
199 |
+ |
return super.addAll(c); |
200 |
+ |
} |
201 |
+ |
|
202 |
+ |
|
203 |
|
// this doc comment is overridden to remove the reference to collections |
204 |
|
// greater in size than Integer.MAX_VALUE |
205 |
|
/** |
435 |
|
} |
436 |
|
} |
437 |
|
|
438 |
< |
public boolean remove(Object x) { |
439 |
< |
if (x == null) return false; |
438 |
> |
public boolean remove(Object o) { |
439 |
> |
if (o == null) return false; |
440 |
|
boolean removed = false; |
441 |
|
fullyLock(); |
442 |
|
try { |
443 |
|
Node<E> trail = head; |
444 |
|
Node<E> p = head.next; |
445 |
|
while (p != null) { |
446 |
< |
if (x.equals(p.item)) { |
446 |
> |
if (o.equals(p.item)) { |
447 |
|
removed = true; |
448 |
|
break; |
449 |
|
} |