org.exolab.adaptx.util
Class ListStack

java.lang.Object
  extended by org.exolab.adaptx.util.List
      extended by org.exolab.adaptx.util.ListStack
All Implemented Interfaces:
java.lang.Cloneable

public class ListStack
extends List

A representation of a Stack that does not use Synchronization. For compatibility this class supports the same methods as a java.util.Stack (JDK)

Author:
Keith Visco

Constructor Summary
ListStack()
          Creates an empty Stack
 
Method Summary
 boolean empty()
          Tests for an empty Stack
 java.lang.Object peek()
          Returns the Object that is currently on top of the Stack.
 java.lang.Object pop()
          Removes and returns the Object that is currently on top of the Stack.
 void push(java.lang.Object object)
          Adds the given Object to the top of the Stack
 int search(java.lang.Object object)
          Searches for the given Object in the stack and returns it's position relative to the top of the Stack.
 
Methods inherited from class org.exolab.adaptx.util.List
add, add, clear, clone, contains, equals, get, hashCode, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListStack

public ListStack()
Creates an empty Stack

Method Detail

empty

public boolean empty()
Tests for an empty Stack

Returns:
true if there are no elements on the stack, otherwise false.

peek

public java.lang.Object peek()
                      throws java.util.EmptyStackException
Returns the Object that is currently on top of the Stack. Unlike #pop the Object is not removed from the Stack.

Returns:
the Object that is currently the top of the stack
Throws:
java.util.EmptyStackException - when there are no elements currently on the Stack

pop

public java.lang.Object pop()
                     throws java.util.EmptyStackException
Removes and returns the Object that is currently on top of the Stack.

Returns:
the Object that is currently the top of the stack
Throws:
java.util.EmptyStackException - when there are no elements currently on the Stack

push

public void push(java.lang.Object object)
Adds the given Object to the top of the Stack


search

public int search(java.lang.Object object)
Searches for the given Object in the stack and returns it's position relative to the top of the Stack.