Interface Stack<E>

All Known Implementing Classes:
ArrayListStack, ArrayStack, LinkedListStack

public interface Stack<E>

An abstract definition of a stack

Author:
Barb Ericson

Method Summary
 boolean isEmpty()
          Method to check if the stack is empty
 E peek()
          Method to return the top element on the stack, but not remove it from the stack
 E pop()
          Method to remove the top element from the stack and return it
 void push(E element)
          Method to add the element to the top of the stack
 int size()
          Method to return the number of elements in the stack
 

Method Detail

push

void push(E element)
Method to add the element to the top of the stack

Parameters:
element - the element to add

peek

E peek()
Method to return the top element on the stack, but not remove it from the stack

Returns:
the top object from the stack

pop

E pop()
Method to remove the top element from the stack and return it

Returns:
the top element from the stack

size

int size()
Method to return the number of elements in the stack

Returns:
the number of elements in the stack

isEmpty

boolean isEmpty()
Method to check if the stack is empty

Returns:
true if empty, else false