diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
| commit | 65bf3316cf384588453604be6b4f0ed3751a8b0f (patch) | |
| tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/java/util/Stack.java | |
| parent | 8fc56618a84446beccd45b80381cdfe0e94050df (diff) | |
| download | gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.tar.gz | |
Merged gcj-eclipse branch to trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/util/Stack.java')
| -rw-r--r-- | libjava/classpath/java/util/Stack.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libjava/classpath/java/util/Stack.java b/libjava/classpath/java/util/Stack.java index 730ce177cd1..404a146c272 100644 --- a/libjava/classpath/java/util/Stack.java +++ b/libjava/classpath/java/util/Stack.java @@ -1,6 +1,7 @@ /* Stack.java - Class that provides a Last In First Out (LIFO) datatype, known more commonly as a Stack - Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2004, 2005 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -58,7 +59,7 @@ package java.util; * @since 1.0 * @status updated to 1.4 */ -public class Stack extends Vector +public class Stack<T> extends Vector<T> { // We could use Vector methods internally for the following methods, // but have used Vector fields directly for efficiency (i.e. this @@ -84,7 +85,7 @@ public class Stack extends Vector * @return the Object pushed onto the stack * @see Vector#addElement(Object) */ - public Object push(Object item) + public T push(T item) { // When growing the Stack, use the Vector routines in case more // memory is needed. @@ -101,13 +102,13 @@ public class Stack extends Vector * @return the Object popped from the stack * @throws EmptyStackException if the stack is empty */ - public synchronized Object pop() + public synchronized T pop() { if (elementCount == 0) throw new EmptyStackException(); modCount++; - Object obj = elementData[--elementCount]; + T obj = elementData[--elementCount]; // Set topmost element to null to assist the gc in cleanup. elementData[elementCount] = null; @@ -120,7 +121,7 @@ public class Stack extends Vector * @return the top Object on the stack * @throws EmptyStackException if the stack is empty */ - public synchronized Object peek() + public synchronized T peek() { if (elementCount == 0) throw new EmptyStackException(); |
