76 |
|
private final Condition notFull = lock.newCondition(); |
77 |
|
|
78 |
|
/** |
79 |
< |
* Creates a <tt>LinkedBlockingDeque</tt> with a capacity of |
79 |
> |
* Creates a {@code LinkedBlockingDeque} with a capacity of |
80 |
|
* {@link Integer#MAX_VALUE}. |
81 |
|
*/ |
82 |
|
public LinkedBlockingDeque() { |
84 |
|
} |
85 |
|
|
86 |
|
/** |
87 |
< |
* Creates a <tt>LinkedBlockingDeque</tt> with the given (fixed) |
87 |
> |
* Creates a {@code LinkedBlockingDeque} with the given (fixed) |
88 |
|
* capacity. |
89 |
|
* @param capacity the capacity of this deque |
90 |
< |
* @throws IllegalArgumentException if <tt>capacity</tt> is less than 1 |
90 |
> |
* @throws IllegalArgumentException if {@code capacity} is less than 1 |
91 |
|
*/ |
92 |
|
public LinkedBlockingDeque(int capacity) { |
93 |
|
if (capacity <= 0) throw new IllegalArgumentException(); |
95 |
|
} |
96 |
|
|
97 |
|
/** |
98 |
< |
* Creates a <tt>LinkedBlockingDeque</tt> with a capacity of |
98 |
> |
* Creates a {@code LinkedBlockingDeque} with a capacity of |
99 |
|
* {@link Integer#MAX_VALUE}, initially containing the elements of the |
100 |
|
* given collection, |
101 |
|
* added in traversal order of the collection's iterator. |
102 |
|
* @param c the collection of elements to initially contain |
103 |
< |
* @throws NullPointerException if <tt>c</tt> or any element within it |
104 |
< |
* is <tt>null</tt> |
103 |
> |
* @throws NullPointerException if {@code c} or any element within it |
104 |
> |
* is {@code null} |
105 |
|
*/ |
106 |
|
public LinkedBlockingDeque(Collection<? extends E> c) { |
107 |
|
this(Integer.MAX_VALUE); |
459 |
|
* Returns the number of elements that this deque can ideally (in |
460 |
|
* the absence of memory or resource constraints) accept without |
461 |
|
* blocking. This is always equal to the initial capacity of this deque |
462 |
< |
* less the current <tt>size</tt> of this deque. |
462 |
> |
* less the current {@code size} of this deque. |
463 |
|
* <p>Note that you <em>cannot</em> always tell if |
464 |
< |
* an attempt to <tt>add</tt> an element will succeed by |
465 |
< |
* inspecting <tt>remainingCapacity</tt> because it may be the |
466 |
< |
* case that a waiting consumer is ready to <tt>take</tt> an |
464 |
> |
* an attempt to {@code add} an element will succeed by |
465 |
> |
* inspecting {@code remainingCapacity} because it may be the |
466 |
> |
* case that a waiting consumer is ready to {@code take} an |
467 |
|
* element out of an otherwise full deque. |
468 |
|
*/ |
469 |
|
public int remainingCapacity() { |
641 |
|
|
642 |
|
/** |
643 |
|
* Returns an iterator over the elements in this deque in proper sequence. |
644 |
< |
* The returned <tt>Iterator</tt> is a "weakly consistent" iterator that |
644 |
> |
* The returned {@code Iterator} is a "weakly consistent" iterator that |
645 |
|
* will never throw {@link java.util.ConcurrentModificationException}, |
646 |
|
* and guarantees to traverse elements as they existed upon |
647 |
|
* construction of the iterator, and may (but is not guaranteed to) |
720 |
|
* Saves the state to a stream (that is, serializes it). |
721 |
|
* |
722 |
|
* @serialData The capacity (int), followed by elements (each an |
723 |
< |
* <tt>Object</tt>) in the proper order, followed by a null |
723 |
> |
* {@code Object}) in the proper order, followed by a null |
724 |
|
* @param s the stream |
725 |
|
*/ |
726 |
|
private void writeObject(java.io.ObjectOutputStream s) |