[all packages]
[package gj.util]
[class hierarchy]
[index]
public class gj.util.Stack<A>
(source file: util/Stack.java)
java.lang.Object
|
+----gj.util.Vector<A>
|
+----gj.util.Stack<A>
The pure class interface.
public class Stack<A>
extends Vector<A>
-
A Last-In-First-Out(LIFO) stack of objects.
- Stack()
-
- empty()
-
Returns true if the stack is empty.
- peek()
-
Peeks at the top of the stack.
- pop()
-
Pops an item off the stack.
- push(A)
-
Pushes an item onto the stack.
- search(A)
-
Sees if an object is on the stack.
Stack
public Stack();
push
public A push(A item);
-
Pushes an item onto the stack.
- Parameters:
- item - the item to be pushed on.
pop
public A pop();
-
Pops an item off the stack.
- Throws:
- EmptyStackException -If the stack is empty.
-
peek
public A peek();
-
Peeks at the top of the stack.
- Throws:
- EmptyStackException -If the stack is empty.
-
empty
public boolean empty();
-
Returns true if the stack is empty.
search
public int search(A o);
-
Sees if an object is on the stack.
- Parameters:
- o - the desired object
- Returns:
- the distance from the top, or -1 if it is not found.
[all packages]
[package gj.util]
[class hierarchy]
[index]
gj.util.Stack.html