ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/LinkedTransferQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/LinkedTransferQueue.java (file contents):
Revision 1.109 by jsr166, Sat Dec 24 18:13:56 2016 UTC vs.
Revision 1.110 by jsr166, Sat Dec 24 18:37:26 2016 UTC

# Line 719 | Line 719 | public class LinkedTransferQueue<E> exte
719      /* -------------- Traversal methods -------------- */
720  
721      /**
722     * Returns the successor of p, or the head node if p.next has been
723     * linked to self, which will only be true if traversing with a
724     * stale pointer that is now off the list.
725     */
726    final Node succ(Node p) {
727        Node next = p.next;
728        return (p == next) ? head : next;
729    }
730
731    /**
722       * Returns the first unmatched data node, or null if none.
723       * Callers must recheck if the returned node is unmatched
724       * before using.
# Line 1478 | Line 1468 | public class LinkedTransferQueue<E> exte
1468       */
1469      public boolean contains(Object o) {
1470          if (o != null) {
1471 <            for (Node p = head; p != null; p = succ(p)) {
1471 >            for (Node p = head; p != null; ) {
1472                  Object item = p.item;
1473                  if (p.isData) {
1474                      if (item != null && o.equals(item))
# Line 1486 | Line 1476 | public class LinkedTransferQueue<E> exte
1476                  }
1477                  else if (item == null)
1478                      break;
1479 +                if (p == (p = p.next))
1480 +                    p = head;
1481              }
1482          }
1483          return false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines