454 |
|
} |
455 |
|
|
456 |
|
/** |
457 |
< |
* Returns the number of elements that this deque can ideally (in |
458 |
< |
* the absence of memory or resource constraints) accept without |
457 |
> |
* Returns the number of additional elements that this deque can ideally |
458 |
> |
* (in the absence of memory or resource constraints) accept without |
459 |
|
* blocking. This is always equal to the initial capacity of this deque |
460 |
|
* less the current <tt>size</tt> of this deque. |
461 |
< |
* <p>Note that you <em>cannot</em> always tell if |
462 |
< |
* an attempt to <tt>add</tt> an element will succeed by |
463 |
< |
* inspecting <tt>remainingCapacity</tt> because it may be the |
464 |
< |
* case that a waiting consumer is ready to <tt>take</tt> an |
465 |
< |
* element out of an otherwise full deque. |
461 |
> |
* |
462 |
> |
* <p>Note that you <em>cannot</em> always tell if an attempt to insert |
463 |
> |
* an element will succeed by inspecting <tt>remainingCapacity</tt> |
464 |
> |
* because it may be the case that another thread is about to |
465 |
> |
* <tt>put</tt> or <tt>take</tt> an element. |
466 |
|
*/ |
467 |
|
public int remainingCapacity() { |
468 |
|
lock.lock(); |