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.17 by dl, Thu Sep 15 16:55:24 2005 UTC vs.
Revision 1.18 by jsr166, Fri Sep 16 04:41:04 2005 UTC

# Line 538 | Line 538 | public class ArrayDeque<E> extends Abstr
538       * order that elements would be dequeued (via successive calls to
539       * {@link #remove} or popped (via successive calls to {@link #pop}).
540       *
541 <     * @return an <tt>Iterator</tt> over the elements in this deque
541 >     * @return an iterator over the elements in this deque
542       */
543      public Iterator<E> iterator() {
544          return new DeqIterator();
545      }
546  
547    /**
548     * Returns an iterator over the elements in this deque in reverse
549     * sequential order.  The elements will be returned in order from
550     * last (tail) to first (head).
551     *
552     * @return an iterator over the elements in this deque in reverse
553     * sequence
554     */
547      public Iterator<E> descendingIterator() {
548          return new DescendingIterator();
549      }
# Line 603 | Line 595 | public class ArrayDeque<E> extends Abstr
595  
596  
597      private class DescendingIterator implements Iterator<E> {
598 <        /*
598 >        /*
599           * This class is nearly a mirror-image of DeqIterator, using
600           * (tail-1) instead of head for initial cursor, (head-1)
601           * instead of tail for fence, and elements.length instead of -1
# Line 622 | Line 614 | public class ArrayDeque<E> extends Abstr
614              E result;
615              if (cursor == fence)
616                  throw new NoSuchElementException();
617 <            if (((head - 1) & (elements.length - 1)) != fence ||
617 >            if (((head - 1) & (elements.length - 1)) != fence ||
618                  (result = elements[cursor]) == null)
619                  throw new ConcurrentModificationException();
620              lastRet = cursor;
# Line 633 | Line 625 | public class ArrayDeque<E> extends Abstr
625          public void remove() {
626              if (lastRet >= elements.length)
627                  throw new IllegalStateException();
628 <            if (!delete(lastRet))
628 >            if (!delete(lastRet))
629                  cursor = (cursor + 1) & (elements.length - 1);
630              lastRet = elements.length;
631              fence = (head - 1) & (elements.length - 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines