Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/java/util/LinkedList.java
          +++ new/src/share/classes/java/util/LinkedList.java
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20   20   *
  21   21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22   22   * or visit www.oracle.com if you need additional information or have any
  23   23   * questions.
  24   24   */
  25   25  
  26   26  package java.util;
  27   27  
  28   28  /**
  29      - * Linked list implementation of the {@link List} and {@link Deque} interfaces.
  30      - * Implements all optional operations, and permits all elements (including
  31      - * {@code null}).
       29 + * Linked list implementation of the {@code List} interface.  Implements all
       30 + * optional list operations, and permits all elements (including
       31 + * {@code null}).  In addition to implementing the {@code List} interface,
       32 + * the {@code LinkedList} class provides uniformly named methods to
       33 + * {@code get}, {@code remove} and {@code insert} an element at the
       34 + * beginning and end of the list.  These operations allow linked lists to be
       35 + * used as a stack, {@linkplain Queue queue}, or {@linkplain Deque
       36 + * double-ended queue}.
  32   37   *
       38 + * <p>The class implements the {@code Deque} interface, providing
       39 + * first-in-first-out queue operations for {@code add},
       40 + * {@code poll}, along with other stack and deque operations.
       41 + *
  33   42   * <p>All of the operations perform as could be expected for a doubly-linked
  34   43   * list.  Operations that index into the list will traverse the list from
  35   44   * the beginning or the end, whichever is closer to the specified index.
  36   45   *
  37   46   * <p><strong>Note that this implementation is not synchronized.</strong>
  38   47   * If multiple threads access a linked list concurrently, and at least
  39   48   * one of the threads modifies the list structurally, it <i>must</i> be
  40   49   * synchronized externally.  (A structural modification is any operation
  41   50   * that adds or deletes one or more elements; merely setting the value of
  42   51   * an element is not a structural modification.)  This is typically
↓ open down ↓ 199 lines elided ↑ open up ↑
 242  251              throw new NoSuchElementException();
 243  252          return f.item;
 244  253      }
 245  254  
 246  255      /**
 247  256       * Returns the last element in this list.
 248  257       *
 249  258       * @return the last element in this list
 250  259       * @throws NoSuchElementException if this list is empty
 251  260       */
 252      -    public E getLast()  {
      261 +    public E getLast() {
 253  262          final Node<E> l = last;
 254  263          if (l == null)
 255  264              throw new NoSuchElementException();
 256  265          return l.item;
 257  266      }
 258  267  
 259  268      /**
 260  269       * Removes and returns the first element from this list.
 261  270       *
 262  271       * @return the first element from this list
↓ open down ↓ 876 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX