14 |
|
* An optionally-bounded {@linkplain BlockingDeque blocking deque} based on |
15 |
|
* linked nodes. |
16 |
|
* |
17 |
< |
* <p> The optional capacity bound constructor argument serves as a |
17 |
> |
* <p>The optional capacity bound constructor argument serves as a |
18 |
|
* way to prevent excessive expansion. The capacity, if unspecified, |
19 |
|
* is equal to {@link Integer#MAX_VALUE}. Linked nodes are |
20 |
|
* dynamically created upon each insertion unless this would bring the |
149 |
|
} |
150 |
|
|
151 |
|
/** |
152 |
< |
* Remove and return first element, or null if empty |
152 |
> |
* Removes and returns first element, or null if empty. |
153 |
|
*/ |
154 |
|
private E unlinkFirst() { |
155 |
|
Node<E> f = first; |
167 |
|
} |
168 |
|
|
169 |
|
/** |
170 |
< |
* Remove and return last element, or null if empty |
170 |
> |
* Removes and returns last element, or null if empty. |
171 |
|
*/ |
172 |
|
private E unlinkLast() { |
173 |
|
Node<E> l = last; |
444 |
|
/** |
445 |
|
* Returns the number of elements in this deque. |
446 |
|
* |
447 |
< |
* @return the number of elements in this deque. |
447 |
> |
* @return the number of elements in this deque |
448 |
|
*/ |
449 |
|
public int size() { |
450 |
|
lock.lock(); |
647 |
|
* construction of the iterator, and may (but is not guaranteed to) |
648 |
|
* reflect any modifications subsequent to construction. |
649 |
|
* |
650 |
< |
* @return an iterator over the elements in this deque in proper sequence. |
650 |
> |
* @return an iterator over the elements in this deque in proper sequence |
651 |
|
*/ |
652 |
|
public Iterator<E> iterator() { |
653 |
|
return new Itr(); |
664 |
|
* an element exists in hasNext(), we must return item read |
665 |
|
* under lock (in advance()) even if it was in the process of |
666 |
|
* being removed when hasNext() was called. |
667 |
< |
**/ |
667 |
> |
*/ |
668 |
|
private E nextItem; |
669 |
|
|
670 |
|
/** |