--- jsr166/src/main/java/util/LinkedList.java 2005/08/11 08:53:47 1.39 +++ jsr166/src/main/java/util/LinkedList.java 2006/01/10 21:32:09 1.43 @@ -1,7 +1,7 @@ /* * %W% %E% * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ @@ -799,6 +799,27 @@ public class LinkedList } /** + * @since 1.6 + */ + public Iterator descendingIterator() { + return new DescendingIterator(); + } + + /** Adapter to provide descending iterators via ListItr.previous */ + private class DescendingIterator implements Iterator { + final ListItr itr = new ListItr(size()); + public boolean hasNext() { + return itr.hasPrevious(); + } + public E next() { + return itr.previous(); + } + public void remove() { + itr.remove(); + } + } + + /** * Returns a shallow copy of this LinkedList. (The elements * themselves are not cloned.) *