org.openejb.util
Class ArrayStack

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by java.util.ArrayList
              extended by org.openejb.util.ArrayStack
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess, Stack

public final class ArrayStack
extends java.util.ArrayList
implements Stack

Unsynchronized Stack.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ArrayStack()
           
 
Method Summary
 java.lang.Object peek()
          Looks at the object at the top of this stack without removing it from the stack.
 java.lang.Object pop()
          Removes the object at the top of this stack and returns that object as the value of this function.
 java.lang.Object push(java.lang.Object item)
          Adds the object to the top of the stack.
 void setSize(int newSize)
          Sets the size of the stack and prunes entries from the top of the stack that exceed the stack's new size.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openejb.util.Stack
size
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

ArrayStack

public ArrayStack()
Method Detail

setSize

public void setSize(int newSize)
Sets the size of the stack and prunes entries from the top of the stack that exceed the stack's new size.


push

public java.lang.Object push(java.lang.Object item)
Adds the object to the top of the stack.

Specified by:
push in interface Stack

pop

public java.lang.Object pop()
Removes the object at the top of this stack and returns that object as the value of this function.

Specified by:
pop in interface Stack
Returns:
The object at the top of this stack.
Throws:
java.util.EmptyStackException - if this stack is empty.

peek

public java.lang.Object peek()
Looks at the object at the top of this stack without removing it from the stack.

Returns:
the object at the top of this stack.
Throws:
java.util.EmptyStackException - if this stack is empty.


Copyright © 1999-2011 OpenEJB. All Rights Reserved.