diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
commit | 97b8365cafc3a344a22d3980b8ed885f5c6d8357 (patch) | |
tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/java/util/Stack.java | |
parent | c648dedbde727ca3f883bb5fd773aa4af70d3369 (diff) | |
download | gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.gz |
Merged gcj-eclipse branch to trunk.
From-SVN: r120621
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(); |