org.jawk.util
Interface MyStack<E>

All Known Implementing Classes:
ArrayStackImpl, LinkedListStackImpl

public interface MyStack<E>

A stack-like interface.

Unfortunately, java.util.Stack uses a Vector, and is, therefore, needlessly synchronized in a non-multi-threaded environment. As a result, it was necessary to reimplement the stack in this manner by using a non-synchronized list.


Method Summary
 void clear()
          Eliminate all items from the stack.
 E peek()
          Inspect the top-most element without affecting the stack.
 E pop()
          Pop an item off the stack and return that item to the callee.
 void push(E o)
          Push an item onto the stack.
 int size()
           
 

Method Detail

push

void push(E o)
Push an item onto the stack.

Parameters:
o - The item to push onto the stack.

pop

E pop()
Pop an item off the stack and return that item to the callee.

Returns:
The top of the stack, which is subsequently removed from the stack.

size

int size()
Returns:
The number of elements within the stack.

clear

void clear()
Eliminate all items from the stack.


peek

E peek()
Inspect the top-most element without affecting the stack.