diff options
Diffstat (limited to 'java/util/LinkedList.java')
-rw-r--r-- | java/util/LinkedList.java | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/java/util/LinkedList.java b/java/util/LinkedList.java index e24ceece9..ed067cfe4 100644 --- a/java/util/LinkedList.java +++ b/java/util/LinkedList.java @@ -72,7 +72,7 @@ import java.lang.reflect.Array; * @status missing javadoc, but complete to 1.4 */ public class LinkedList<T> extends AbstractSequentialList<T> - implements List<T>, Cloneable, Serializable + implements List<T>, Queue<T>, Cloneable, Serializable { /** * Compatible with JDK 1.2. @@ -708,6 +708,50 @@ public class LinkedList<T> extends AbstractSequentialList<T> } /** + * @since 1.5 + */ + public boolean offer(T value) + { + return add(value); + } + + /** + * @since 1.5 + */ + public T element() + { + return getFirst(); + } + + /** + * @since 1.5 + */ + public T peek() + { + if (size == 0) + return null; + return getFirst(); + } + + /** + * @since 1.5 + */ + public T poll() + { + if (size == 0) + return null; + return removeFirst(); + } + + /** + * @since 1.5 + */ + public T remove() + { + return removeFirst(); + } + + /** * Serializes this object to the given stream. * * @param s the stream to write to |