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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentLinkedQueue.java (file contents):
Revision 1.140 by jsr166, Wed Dec 28 04:57:36 2016 UTC vs.
Revision 1.141 by jsr166, Thu Dec 29 02:39:40 2016 UTC

# Line 423 | Line 423 | public class ConcurrentLinkedQueue<E> ex
423      public boolean contains(Object o) {
424          if (o == null) return false;
425          restartFromHead: for (;;) {
426 <            for (Node<E> p = head, c = p, pred = null, q; p != null; p = q) {
426 >            for (Node<E> p = head, c = p, pred = null, q; p != null; ) {
427                  final E item;
428                  if ((item = p.item) != null && o.equals(item))
429                      return true;
# Line 432 | Line 432 | public class ConcurrentLinkedQueue<E> ex
432                  q = p.next;
433                  if (item != null || c != p) {
434                      pred = p;
435 <                    c = q;
435 >                    p = c = q;
436                  }
437 <                else if (p == q)
437 >                else if (p == (p = q))
438                      continue restartFromHead;
439              }
440              return false;
# Line 455 | Line 455 | public class ConcurrentLinkedQueue<E> ex
455      public boolean remove(Object o) {
456          if (o == null) return false;
457          restartFromHead: for (;;) {
458 <            for (Node<E> p = head, c = p, pred = null, q; p != null; p = q) {
458 >            for (Node<E> p = head, c = p, pred = null, q; p != null; ) {
459                  final E item;
460                  final boolean removed =
461                      (item = p.item) != null
# Line 468 | Line 468 | public class ConcurrentLinkedQueue<E> ex
468                  q = p.next;
469                  if (item != null || c != p) {
470                      pred = p;
471 <                    c = q;
471 >                    p = c = q;
472                  }
473 <                else if (p == q)
473 >                else if (p == (p = q))
474                      continue restartFromHead;
475              }
476              return false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines