1 |
|
/* |
2 |
< |
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. |
2 |
> |
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. |
3 |
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
|
* |
5 |
|
* This code is free software; you can redistribute it and/or modify it |
18 |
|
* 2 along with this work; if not, write to the Free Software Foundation, |
19 |
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
|
* |
21 |
< |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
22 |
< |
* CA 95054 USA or visit www.sun.com if you need additional information or |
23 |
< |
* have any questions. |
21 |
> |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
> |
* or visit www.oracle.com if you need additional information or have any |
23 |
> |
* questions. |
24 |
|
*/ |
25 |
|
|
26 |
|
package java.util; |
27 |
|
|
28 |
|
/** |
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}. |
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. |
29 |
> |
* Doubly-linked list implementation of the {@code List} and {@code Deque} |
30 |
> |
* interfaces. Implements all optional list operations, and permits all |
31 |
> |
* elements (including {@code null}). |
32 |
|
* |
33 |
|
* <p>All of the operations perform as could be expected for a doubly-linked |
34 |
|
* list. Operations that index into the list will traverse the list from |
249 |
|
* @return the last element in this list |
250 |
|
* @throws NoSuchElementException if this list is empty |
251 |
|
*/ |
252 |
< |
public E getLast() { |
252 |
> |
public E getLast() { |
253 |
|
final Node<E> l = last; |
254 |
|
if (l == null) |
255 |
|
throw new NoSuchElementException(); |