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.27 by jsr166, Sat May 14 02:19:00 2005 UTC vs.
Revision 1.28 by jsr166, Mon May 16 05:17:07 2005 UTC

# Line 165 | Line 165 | public class LinkedList<E>
165      /**
166       * Returns <tt>true</tt> if this list contains the specified element.
167       * More formally, returns <tt>true</tt> if and only if this list contains
168 <     * at least one element <tt>e</tt> such that <tt>(o==null ? e==null
169 <     * : o.equals(e))</tt>.
168 >     * at least one element <tt>e</tt> such that
169 >     * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>.
170       *
171       * @param o element whose presence in this list is to be tested
172       * @return <tt>true</tt> if this list contains the specified element
# Line 196 | Line 196 | public class LinkedList<E>
196      }
197  
198      /**
199 <     * Removes the first occurrence of the specified element in this list.  If
200 <     * the list does not contain the element, it is unchanged.  More formally,
201 <     * removes the element with the lowest index <tt>i</tt> such that
202 <     * <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt> (if such an
203 <     * element exists).
199 >     * Removes the first occurrence of the specified element from this list,
200 >     * if it is present.  If this list does not contain the element, it is
201 >     * unchanged.  More formally, removes the element with the lowest index
202 >     * <tt>i</tt> such that
203 >     * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>
204 >     * (if such an element exists).  Returns <tt>true</tt> if this list
205 >     * contained the specified element (or equivalently, if this list
206 >     * changed as a result of the call).
207       *
208       * @param o element to be removed from this list, if present
209 <     * @return <tt>true</tt> if the list contained the specified element
209 >     * @return <tt>true</tt> if this list contained the specified element
210       */
211      public boolean remove(Object o) {
212          if (o==null) {
# Line 252 | Line 255 | public class LinkedList<E>
255       *              from the specified collection
256       * @param c elements to be inserted into this list
257       * @return <tt>true</tt> if this list changed as a result of the call
258 <     * @throws IndexOutOfBoundsException if the index is out of range
256 <     *         (<tt>index &lt; 0 || index &gt; size()</tt>)
258 >     * @throws IndexOutOfBoundsException {@inheritDoc}
259       * @throws NullPointerException if the specified collection is null
260       */
261      public boolean addAll(int index, Collection<? extends E> c) {
# Line 301 | Line 303 | public class LinkedList<E>
303      /**
304       * Returns the element at the specified position in this list.
305       *
306 <     * @param index index of element to return
306 >     * @param index index of the element to return
307       * @return the element at the specified position in this list
308 <     * @throws IndexOutOfBoundsException if the index is out of range
307 <     *         (<tt>index &lt; 0 || index &gt; size()</tt>)
308 >     * @throws IndexOutOfBoundsException {@inheritDoc}
309       */
310      public E get(int index) {
311          return entry(index).element;
# Line 314 | Line 315 | public class LinkedList<E>
315       * Replaces the element at the specified position in this list with the
316       * specified element.
317       *
318 <     * @param index index of element to replace
318 >     * @param index index of the element to replace
319       * @param element element to be stored at the specified position
320       * @return the element previously at the specified position
321 <     * @throws IndexOutOfBoundsException if the index is out of range
321 <     *         (<tt>index &lt; 0 || index &gt; size()</tt>)
321 >     * @throws IndexOutOfBoundsException {@inheritDoc}
322       */
323      public E set(int index, E element) {
324          Entry<E> e = entry(index);
# Line 334 | Line 334 | public class LinkedList<E>
334       *
335       * @param index index at which the specified element is to be inserted
336       * @param element element to be inserted
337 <     *
338 <     * @throws IndexOutOfBoundsException if the index is out of range
339 <     *         (<tt>index &lt; 0 || index &gt; size()</tt>)
337 >     * @throws IndexOutOfBoundsException {@inheritDoc}
338       */
339      public void add(int index, E element) {
340          addBefore(element, (index==size ? header : entry(index)));
# Line 349 | Line 347 | public class LinkedList<E>
347       *
348       * @param index the index of the element to be removed
349       * @return the element previously at the specified position
350 <     *
353 <     * @throws IndexOutOfBoundsException if the index is out of range
354 <     *         (<tt>index &lt; 0 || index &gt; size()</tt>)
350 >     * @throws IndexOutOfBoundsException {@inheritDoc}
351       */
352      public E remove(int index) {
353          return remove(entry(index));
# Line 524 | Line 520 | public class LinkedList<E>
520       * or returns <tt>null</tt> if this list is empty.
521       *
522       * @return the first element of this list, or <tt>null</tt>
523 <     *         if this list is empty.
523 >     *         if this list is empty
524       * @since 1.6
525       */
526      public E peekFirst() {
# Line 538 | Line 534 | public class LinkedList<E>
534       * or returns <tt>null</tt> if this list is empty.
535       *
536       * @return the last element of this list, or <tt>null</tt>
537 <     *         if this list is empty.
537 >     *         if this list is empty
538       * @since 1.6
539       */
540      public E peekLast() {
# Line 659 | Line 655 | public class LinkedList<E>
655       * time in the future.
656       *
657       * @param index index of the first element to be returned from the
658 <     *              list-iterator (by a call to <tt>next</tt>).
658 >     *              list-iterator (by a call to <tt>next</tt>)
659       * @return a ListIterator of the elements in this list (in proper
660 <     *         sequence), starting at the specified position in the list.
661 <     * @throws IndexOutOfBoundsException if the index is out of range
666 <     *         (<tt>index &lt; 0 || index &gt; size()</tt>).
660 >     *         sequence), starting at the specified position in the list
661 >     * @throws IndexOutOfBoundsException {@inheritDoc}
662       * @see List#listIterator(int)
663       */
664      public ListIterator<E> listIterator(int index) {
# Line 832 | Line 827 | public class LinkedList<E>
827       * in the correct order.
828       *
829       * @return an array containing all of the elements in this list
830 <     *         in the correct order.
830 >     *         in the correct order
831       */
832      public Object[] toArray() {
833          Object[] result = new Object[size];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines