All Packages Class Hierarchy This Package Previous Next Index
Class com.kvisco.util.ListStack
com.kvisco.util.List
|
+----com.kvisco.util.ListStack
- 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
-
ListStack()
- Creates an empty Stack
-
empty()
- Tests for an empty Stack
-
peek()
- 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.
-
push(Object)
- Adds the given Object to the top of the Stack
-
search(Object)
- Searches for the given Object in the stack and returns it's position
relative to the top of the Stack.
ListStack
public ListStack()
- Creates an empty Stack
empty
public boolean empty()
- Tests for an empty Stack
- Returns:
- true if there are no elements on the stack, otherwise false.
peek
public Object peek() throws 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: EmptyStackException
- when there are no
elements currently on the Stack
pop
public Object pop() throws 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: EmptyStackException
- when there are no
elements currently on the Stack
push
public void push(Object object)
- Adds the given Object to the top of the Stack
search
public int search(Object object)
- Searches for the given Object in the stack and returns it's position
relative to the top of the Stack.
All Packages Class Hierarchy This Package Previous Next Index