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

Comparing jsr166/src/main/java/util/ArrayDeque.java (file contents):
Revision 1.107 by jsr166, Sat Nov 5 05:12:14 2016 UTC vs.
Revision 1.109 by jsr166, Sat Nov 5 16:21:06 2016 UTC

# Line 244 | Line 244 | public class ArrayDeque<E> extends Abstr
244      }
245  
246      /**
247     * Returns the array index of the last element.
248     * May return invalid index -1 if there are no elements.
249     */
250    final int last() {
251        return dec(tail, elements.length);
252    }
253
254    /**
247       * Returns element at array index i.
248       * This is a slight abuse of generics, accepted by javac.
249       */
# Line 752 | Line 744 | public class ArrayDeque<E> extends Abstr
744      }
745  
746      private class DescendingIterator extends DeqIterator {
747 <        DescendingIterator() { cursor = last(); }
747 >        DescendingIterator() { cursor = dec(tail, elements.length); }
748  
749          public final E next() {
750              if (remaining <= 0)
# Line 779 | Line 771 | public class ArrayDeque<E> extends Abstr
771              final Object[] es = elements;
772              if (es[cursor] == null || sub(cursor, head, es.length) + 1 != r)
773                  throw new ConcurrentModificationException();
774 <            for (int i = cursor, end = head - 1, to = (i >= end) ? end : -1;
774 >            for (int i = cursor, end = head, to = (i >= end) ? end : 0;
775                   ; i = es.length - 1, to = end) {
776 <                for (; i > to; i--)
776 >                for (; i >= to; i--)
777                      action.accept(elementAt(es, i));
778                  if (to == end) {
779 <                    if (end != head - 1)
779 >                    if (end != head)
780                          throw new ConcurrentModificationException();
781                      lastRet = head;
782                      break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines