Package org.exolab.adaptx.util
Class ListStack
java.lang.Object
org.exolab.adaptx.util.List
org.exolab.adaptx.util.ListStack
- All Implemented Interfaces:
Cloneable
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
empty()
Tests for an empty Stackpeek()
Returns the Object that is currently on top of the Stack.pop()
Removes and returns the Object that is currently on top of the Stack.void
Adds the given Object to the top of the Stackint
Searches for the given Object in the stack and returns it's position relative to the top of the Stack.
-
Constructor Details
-
ListStack
public ListStack()Creates an empty Stack
-
-
Method Details
-
empty
public boolean empty()Tests for an empty Stack- Returns:
- true if there are no elements on the stack, otherwise false.
-
peek
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:
EmptyStackException
- when there are no elements currently on the Stack
-
pop
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:
EmptyStackException
- when there are no elements currently on the Stack
-
push
Adds the given Object to the top of the Stack -
search
Searches for the given Object in the stack and returns it's position relative to the top of the Stack.
-