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

Comparing jsr166/src/main/java/util/LinkedList.java (file contents):
Revision 1.39 by jsr166, Thu Aug 11 08:53:47 2005 UTC vs.
Revision 1.40 by dl, Wed Sep 14 23:49:59 2005 UTC

# Line 799 | Line 799 | public class LinkedList<E>
799      }
800  
801      /**
802 +     * Returns an iterator over the elements in this list in reverse
803 +     * sequential order.  The elements will be returned in order from
804 +     * last (tail) to first (head).
805 +     *
806 +     * @return an iterator over the elements in this list in reverse
807 +     * sequence
808 +     */
809 +    public Iterator<E> descendingIterator() {
810 +        return new DescendingIterator();
811 +    }
812 +
813 +    /** Adapter to provide descending iterators via ListItr.previous */
814 +    private class DescendingIterator implements Iterator {
815 +        final ListItr itr = new ListItr(size());
816 +        public boolean hasNext() {
817 +            return itr.hasPrevious();
818 +        }
819 +        public E next() {
820 +            return itr.previous();
821 +        }
822 +        public void remove() {
823 +            itr.remove();
824 +        }
825 +    }
826 +
827 +    /**
828       * Returns a shallow copy of this <tt>LinkedList</tt>. (The elements
829       * themselves are not cloned.)
830       *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines