net.sourceforge.hiveutils.collections.impl
Class StackImpl<T>

java.lang.Object
  extended by net.sourceforge.hiveutils.collections.impl.StackImpl<T>
All Implemented Interfaces:
Stack<T>

public class StackImpl<T>
extends java.lang.Object
implements Stack<T>

Implementation of Stack, based on ArrayList.

Author:
Jean-Francois Poilpret

Constructor Summary
StackImpl()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackImpl

public StackImpl()
Method Detail

push

public void push(T o)
Description copied from interface: Stack
Push an object to the top of the stack.

Specified by:
push in interface Stack<T>
Parameters:
o - object to push on top

pop

public T pop()
Description copied from interface: Stack
Pop the object from the top of the stack. The object is removed from the stack.

Specified by:
pop in interface Stack<T>
Returns:
the object on top of stack

peek

public T peek()
Description copied from interface: Stack
Get the object from the top of the stack. The object stays on top of the stack.

Specified by:
peek in interface Stack<T>
Returns:
the object on top of stack

isEmpty

public boolean isEmpty()
Description copied from interface: Stack
Checks whether the stack is empty.

Specified by:
isEmpty in interface Stack<T>
Returns:
true if the stack is empty

clear

public void clear()
Description copied from interface: Stack
Clears the whole stack.

Specified by:
clear in interface Stack<T>