478 |
|
} |
479 |
|
|
480 |
|
/** |
481 |
< |
* Unlinks interior Node p with predecessor trail. |
481 |
> |
* Unlinks interior Node p with predecessor pred. |
482 |
|
*/ |
483 |
< |
void unlink(Node<E> p, Node<E> trail) { |
483 |
> |
void unlink(Node<E> p, Node<E> pred) { |
484 |
|
// assert putLock.isHeldByCurrentThread(); |
485 |
|
// assert takeLock.isHeldByCurrentThread(); |
486 |
|
// p.next is not changed, to allow iterators that are |
487 |
|
// traversing p to maintain their weak-consistency guarantee. |
488 |
|
p.item = null; |
489 |
< |
trail.next = p.next; |
489 |
> |
pred.next = p.next; |
490 |
|
if (last == p) |
491 |
< |
last = trail; |
491 |
> |
last = pred; |
492 |
|
if (count.getAndDecrement() == capacity) |
493 |
|
notFull.signal(); |
494 |
|
} |
508 |
|
if (o == null) return false; |
509 |
|
fullyLock(); |
510 |
|
try { |
511 |
< |
for (Node<E> trail = head, p = trail.next; |
511 |
> |
for (Node<E> pred = head, p = pred.next; |
512 |
|
p != null; |
513 |
< |
trail = p, p = p.next) { |
513 |
> |
pred = p, p = p.next) { |
514 |
|
if (o.equals(p.item)) { |
515 |
< |
unlink(p, trail); |
515 |
> |
unlink(p, pred); |
516 |
|
return true; |
517 |
|
} |
518 |
|
} |
817 |
|
try { |
818 |
|
Node<E> node = lastRet; |
819 |
|
lastRet = null; |
820 |
< |
for (Node<E> trail = head, p = trail.next; |
820 |
> |
for (Node<E> pred = head, p = pred.next; |
821 |
|
p != null; |
822 |
< |
trail = p, p = p.next) { |
822 |
> |
pred = p, p = p.next) { |
823 |
|
if (p == node) { |
824 |
< |
unlink(p, trail); |
824 |
> |
unlink(p, pred); |
825 |
|
break; |
826 |
|
} |
827 |
|
} |