[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.


Constuctor Index

O Stack()

Methods

O empty()
Returns true if the stack is empty.
O peek()
Peeks at the top of the stack.
O pop()
Pops an item off the stack.
O push(A)
Pushes an item onto the stack.
O search(A)
Sees if an object is on the stack.

Constructors

O Stack
public Stack();

Methods

O push
public A push(A item);
Pushes an item onto the stack.

Parameters:
item - the item to be pushed on.

O pop

public A pop();
Pops an item off the stack.

Throws:
EmptyStackException -If the stack is empty.

O peek

public A peek();
Peeks at the top of the stack.

Throws:
EmptyStackException -If the stack is empty.

O empty

public boolean empty();
Returns true if the stack is empty.

O 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