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

Comparing jsr166/src/main/java/util/concurrent/ArrayBlockingQueue.java (file contents):
Revision 1.128 by jsr166, Sat Nov 5 22:24:57 2016 UTC vs.
Revision 1.129 by jsr166, Sun Nov 6 04:18:30 2016 UTC

# Line 509 | Line 509 | public class ArrayBlockingQueue<E> exten
509          try {
510              if (count > 0) {
511                  final Object[] items = this.items;
512 <                final int putIndex = this.putIndex;
513 <                int i = takeIndex;
514 <                do {
515 <                    if (o.equals(items[i]))
516 <                        return true;
517 <                    if (++i == items.length) i = 0;
518 <                } while (i != putIndex);
512 >                for (int i = takeIndex, end = putIndex,
513 >                         to = (i < end) ? end : items.length;
514 >                     ; i = 0, to = end) {
515 >                    for (; i < to; i++)
516 >                        if (o.equals(items[i]))
517 >                            return true;
518 >                    if (to == end) break;
519 >                }
520              }
521              return false;
522          } finally {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines