Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » tomcat » util » digester » [javadoc | source]
org.apache.tomcat.util.digester
public class: ArrayStack [javadoc | source]
java.lang.Object
   java.util.AbstractCollection
      java.util.AbstractList
         java.util.ArrayList
            org.apache.tomcat.util.digester.ArrayStack

All Implemented Interfaces:
    List, Serializable, RandomAccess, Cloneable, Collection

Imported copy of the ArrayStack class from Commons Collections, which was the only direct dependency from Digester.

WARNNG - This class is public solely to allow it to be used from subpackages of org.apache.commons.digester. It should not be considered part of the public API of Commons Digester. If you want to use such a class yourself, you should use the one from Commons Collections directly.

An implementation of the java.util.Stack API that is based on an ArrayList instead of a Vector, so it is not synchronized to protect against multi-threaded access. The implementation is therefore operates faster in environments where you do not need to worry about multiple thread contention.

Unlike Stack, ArrayStack accepts null entries.

Constructor:
 public ArrayStack() 
 public ArrayStack(int initialSize) 
Method from org.apache.tomcat.util.digester.ArrayStack Summary:
empty,   peek,   peek,   pop,   push,   search
Methods from java.util.ArrayList:
add,   add,   addAll,   addAll,   clear,   clone,   contains,   ensureCapacity,   get,   indexOf,   isEmpty,   lastIndexOf,   remove,   remove,   set,   size,   toArray,   toArray,   trimToSize
Methods from java.util.AbstractList:
add,   add,   addAll,   clear,   equals,   get,   hashCode,   indexOf,   iterator,   lastIndexOf,   listIterator,   listIterator,   remove,   set,   subList
Methods from java.util.AbstractCollection:
add,   addAll,   clear,   contains,   containsAll,   isEmpty,   iterator,   remove,   removeAll,   retainAll,   size,   toArray,   toArray,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tomcat.util.digester.ArrayStack Detail:
 public boolean empty() 
    Return true if this stack is currently empty.

    This method exists for compatibility with java.util.Stack. New users of this class should use isEmpty instead.

 public Object peek() throws EmptyStackException 
    Returns the top item off of this stack without removing it.
 public Object peek(int n) throws EmptyStackException 
    Returns the n'th item down (zero-relative) from the top of this stack without removing it.
 public Object pop() throws EmptyStackException 
    Pops the top item off of this stack and return it.
 public Object push(Object item) 
    Pushes a new item onto the top of this stack. The pushed item is also returned. This is equivalent to calling add.
 public int search(Object object) 
    Returns the one-based position of the distance from the top that the specified object exists on this stack, where the top-most element is considered to be at distance 1. If the object is not present on the stack, return -1 instead. The equals() method is used to compare to the items in this stack.