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.31 by jsr166, Tue May 17 22:04:55 2005 UTC vs.
Revision 1.36 by jsr166, Sat Jun 18 01:56:01 2005 UTC

# Line 6 | Line 6
6   */
7  
8   package java.util;
9 + import java.util.*; // for javadoc
10  
11   /**
12   * Linked list implementation of the <tt>List</tt> interface.  Implements all
# Line 92 | Line 93 | public class LinkedList<E>
93       * @param  c the collection whose elements are to be placed into this list
94       * @throws NullPointerException if the specified collection is null
95       */
96 <     public LinkedList(Collection<? extends E> c) {
97 <         this();
98 <         addAll(c);
99 <     }
96 >    public LinkedList(Collection<? extends E> c) {
97 >        this();
98 >        addAll(c);
99 >    }
100  
101      /**
102       * Returns the first element in this list.
# Line 144 | Line 145 | public class LinkedList<E>
145      }
146  
147      /**
148 <     * Inserts the given element at the beginning of this list.
148 >     * Inserts the specified element at the beginning of this list.
149       *
150 <     * @param e the element to be inserted at the beginning of this list
150 >     * @param e the element to add
151       */
152      public void addFirst(E e) {
153          addBefore(e, header.next);
154      }
155  
156      /**
157 <     * Appends the given element to the end of this list.  (Identical in
157 <     * function to the <tt>add</tt> method; included only for consistency.)
157 >     * Appends the specified element to the end of this list.
158       *
159 <     * @param e the element to be inserted at the end of this list
159 >     * <p>This method is equivalent to {@link #add}.
160 >     *
161 >     * @param e the element to add
162       */
163      public void addLast(E e) {
164          addBefore(e, header);
# Line 187 | Line 189 | public class LinkedList<E>
189      /**
190       * Appends the specified element to the end of this list.
191       *
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})
196       */
# Line 232 | Line 236 | public class LinkedList<E>
236       * this list, in the order that they are returned by the specified
237       * collection's iterator.  The behavior of this operation is undefined if
238       * the specified collection is modified while the operation is in
239 <     * progress.  (This implies that the behavior of this call is undefined if
240 <     * the specified Collection is this list, and this list is nonempty.)
239 >     * progress.  (Note that this will occur if the specified collection is
240 >     * this list, and it's nonempty.)
241       *
242       * @param c collection containing elements to be added to this list
243       * @return <tt>true</tt> if this list changed as a result of the call
# Line 621 | Line 625 | public class LinkedList<E>
625       */
626      public boolean removeLastOccurrence(Object o) {
627          if (o==null) {
628 <            for (Entry e = header.previous; e != header; e = e.previous) {
628 >            for (Entry<E> e = header.previous; e != header; e = e.previous) {
629                  if (e.element==null) {
630                      remove(e);
631                      return true;
632                  }
633              }
634          } else {
635 <            for (Entry e = header.previous; e != header; e = e.previous) {
635 >            for (Entry<E> e = header.previous; e != header; e = e.previous) {
636                  if (o.equals(e.element)) {
637                      remove(e);
638                      return true;
# Line 827 | Line 831 | public class LinkedList<E>
831       * <p>The returned array will be "safe" in that no references to it are
832       * maintained by this list.  (In other words, this method must allocate
833       * a new array).  The caller is thus free to modify the returned array.
834 <     *
834 >     *
835       * <p>This method acts as bridge between array-based and collection-based
836       * APIs.
837       *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines