net.sourceforge.hiveutils.collections
Interface Stack<T>

All Known Implementing Classes:
StackImpl

public interface Stack<T>

Minimal interface for a LIFO Stack, hiding implementation details.

Author:
Jean-Francois Poilpret

Method Summary
 void clear()
          Clears the whole stack.
 boolean isEmpty()
          Checks whether the stack is empty.
 T peek()
          Get the object from the top of the stack.
 T pop()
          Pop the object from the top of the stack.
 void push(T o)
          Push an object to the top of the stack.
 

Method Detail

push

void push(T o)
Push an object to the top of the stack.

Parameters:
o - object to push on top

pop

T pop()
      throws java.util.EmptyStackException
Pop the object from the top of the stack. The object is removed from the stack.

Returns:
the object on top of stack
Throws:
java.util.EmptyStackException - if the stack is empty

peek

T peek()
       throws java.util.EmptyStackException
Get the object from the top of the stack. The object stays on top of the stack.

Returns:
the object on top of stack
Throws:
java.util.EmptyStackException - if the stack is empty

isEmpty

boolean isEmpty()
Checks whether the stack is empty.

Returns:
true if the stack is empty

clear

void clear()
Clears the whole stack.