java.util
Class Stack<E>

java.lang.Object
  extended by java.util.Vector<E>
      extended by java.util.Stack<E>

public class Stack<E>
extends Vector<E>

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?
 E peek()
          fetches an object from the stack
does not remove it!
 E pop()
          fetches an object from the top of the stack and removes it
 E push(E anObject)
          pushes an object onto the stack
 int search(Object o)
           
 
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, toArray, toString, trimToSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Stack

public Stack()
creates a new Stack instance

Method Detail

push

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

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

pop

public E pop()
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 E peek()
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

search

public int search(Object o)