java.util
Class Stack

java.lang.Object
  extended by java.util.Vector
      extended by java.util.Stack

public class Stack
extends Vector

A LIFO stack of objects. TODO recycable


Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Constructor Summary
Stack()
          creates a new Stack instance
 
Method Summary
 boolean empty()
          is this stack empty?
 Object peek()
          fetches an object from the stack
does not remove it!
 Object pop()
          fetches an object from the top of the stack and removes it
 Object push(Object anObject)
          pushes an object onto the stack
 
Methods inherited from class java.util.Vector
addElement, capacity, clear, elementAt, elements, ensureCapacity, equals, indexOf, indexOf, insertElementAt, isEmpty, lastIndexOf, lastIndexOf, removeAllElements, removeElement, removeElementAt, setElementAt, setSize, size, toArray, trimToSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stack

public Stack()
creates a new Stack instance

Method Detail

push

public Object push(Object anObject)
pushes an object onto the stack

Parameters:
anObject - the object
Returns:
Object the object pushed onto the stack

pop

public Object pop()
           throws EmptyStackException
fetches an object from the top of the stack and removes it

Returns:
Object the object removed from the top of the stock
Throws:
EmptyStackException

peek

public Object peek()
            throws EmptyStackException
fetches an object from the stack
does not remove it!

Returns:
Object the object at the top of the stack
Throws:
EmptyStackException

empty

public boolean empty()
is this stack empty?

Returns:
boolean true, if the stack is empty