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.37 by jsr166, Mon Jul 18 01:14:34 2005 UTC vs.
Revision 1.45 by jsr166, Sun May 28 23:36:29 2006 UTC

# Line 1 | Line 1
1   /*
2   * %W% %E%
3   *
4 < * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
4 > * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5   * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6   */
7  
8   package java.util;
9 import java.util.*; // for javadoc (till 6280605 is fixed)
9  
10   /**
11   * Linked list implementation of the <tt>List</tt> interface.  Implements all
# Line 60 | Line 59 | import java.util.*; // for javadoc (till
59   * should be used only to detect bugs.</i>
60   *
61   * <p>This class is a member of the
62 < * <a href="{@docRoot}/../guide/collections/index.html">
62 > * <a href="{@docRoot}/../technotes/guides/collections/index.html">
63   * Java Collections Framework</a>.
64   *
65   * @author  Josh Bloch
# Line 193 | Line 192 | public class LinkedList<E>
192       * <p>This method is equivalent to {@link #addLast}.
193       *
194       * @param e element to be appended to this list
195 <     * @return <tt>true</tt> (as per the spec for {@link Collection#add})
195 >     * @return <tt>true</tt> (as specified by {@link Collection#add})
196       */
197      public boolean add(E e) {
198          addBefore(e, header);
# Line 486 | Line 485 | public class LinkedList<E>
485       * Adds the specified element as the tail (last element) of this list.
486       *
487       * @param e the element to add
488 <     * @return <tt>true</tt> (as per the spec for {@link Queue#offer})
488 >     * @return <tt>true</tt> (as specified by {@link Queue#offer})
489       * @since 1.5
490       */
491      public boolean offer(E e) {
# Line 498 | Line 497 | public class LinkedList<E>
497       * Inserts the specified element at the front of this list.
498       *
499       * @param e the element to insert
500 <     * @return <tt>true</tt> (as per the spec for {@link Deque#offerFirst})
500 >     * @return <tt>true</tt> (as specified by {@link Deque#offerFirst})
501       * @since 1.6
502       */
503      public boolean offerFirst(E e) {
# Line 510 | Line 509 | public class LinkedList<E>
509       * Inserts the specified element at the end of this list.
510       *
511       * @param e the element to insert
512 <     * @return <tt>true</tt> (as per the spec for {@link Deque#offerLast})
512 >     * @return <tt>true</tt> (as specified by {@link Deque#offerLast})
513       * @since 1.6
514       */
515      public boolean offerLast(E e) {
# Line 547 | Line 546 | public class LinkedList<E>
546      }
547  
548      /**
549 <     * Retrieves and removes the first element of this list, or
550 <     * <tt>null</tt> if this list is empty.
549 >     * Retrieves and removes the first element of this list,
550 >     * or returns <tt>null</tt> if this list is empty.
551       *
552       * @return the first element of this list, or <tt>null</tt> if
553       *     this list is empty
# Line 561 | Line 560 | public class LinkedList<E>
560      }
561  
562      /**
563 <     * Retrieves and removes the last element of this list, or
564 <     * <tt>null</tt> if this list is empty.
563 >     * Retrieves and removes the last element of this list,
564 >     * or returns <tt>null</tt> if this list is empty.
565       *
566       * @return the last element of this list, or <tt>null</tt> if
567       *     this list is empty
# Line 799 | Line 798 | public class LinkedList<E>
798      }
799  
800      /**
801 +     * @since 1.6
802 +     */
803 +    public Iterator<E> descendingIterator() {
804 +        return new DescendingIterator();
805 +    }
806 +
807 +    /** Adapter to provide descending iterators via ListItr.previous */
808 +    private class DescendingIterator implements Iterator {
809 +        final ListItr itr = new ListItr(size());
810 +        public boolean hasNext() {
811 +            return itr.hasPrevious();
812 +        }
813 +        public E next() {
814 +            return itr.previous();
815 +        }
816 +        public void remove() {
817 +            itr.remove();
818 +        }
819 +    }
820 +
821 +    /**
822       * Returns a shallow copy of this <tt>LinkedList</tt>. (The elements
823       * themselves are not cloned.)
824       *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines