org.exolab.castor.util
Class Stack
java.lang.Object
org.exolab.castor.util.Stack
public class Stack
extends java.lang.Object
A representation of a Stack that does not use Synchronization.
For compatibility this class supports the same methods as a
java.util.Stack (JDK)
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:09:07 $
Stack() - Creates an empty Stack
|
boolean | empty() - Tests for an empty Stack
|
Iterator | iterator() - Returns an Iterator for this Stack.
|
Object | peek() - Returns the Object that is currently on top of the Stack.
|
Object | pop() - Removes and returns the Object that is currently on top of the Stack.
|
void | push(Object object) - Adds the given Object to the top of the Stack
|
int | search(Object object) - Searches for the given Object in the stack and returns it's position
relative to the top of the Stack (ie the number of calls to #pop()
before the object is returned by #pop())
|
int | size() - Returns the number of items on the Stack
|
Stack
public Stack()
Creates an empty Stack
empty
public boolean empty()
Tests for an empty Stack
- true if there are no elements on the stack, otherwise false.
iterator
public Iterator iterator()
Returns an Iterator for this Stack. The iterator will iterate from
the top of the stack, to the bottom
peek
public 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.
- the Object that is currently the top of the stack
pop
public Object pop()
throws java.util.EmptyStackException
Removes and returns the Object that is currently on top of the Stack.
- the Object that is currently the top of 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 (ie the number of calls to #pop()
before the object is returned by #pop())
size
public int size()
Returns the number of items on the Stack
- the number of items on the Stack
Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com