Home » tiles-2.2.1-src » org.apache » tiles » [javadoc | source]
public class: ArrayStack [javadoc | source]

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

This class has been copied from Apache Commons Collections 3.2.1 and adapted to Java 5 generics. Here follows the original comment.
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.

The removal order of an ArrayStack is based on insertion order: The most recently added element is removed first. The iteration order is not the same as the removal order. The iterator returns elements from the bottom up, whereas the #remove() method removes them from the top down.

Unlike Stack, ArrayStack accepts null entries.

Fields inherited from java.util.AbstractList:
 public ArrayStack() 
 public ArrayStack(int initialSize) 
Method from org.apache.tiles.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,   removeRange,   set,   size,   toArray,   toArray,   trimToSize
Methods from java.util.AbstractList:
add,   add,   addAll,   clear,   equals,   get,   hashCode,   indexOf,   iterator,   lastIndexOf,   listIterator,   listIterator,   remove,   removeRange,   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:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tiles.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 T peek() 
    Returns the top item off of this stack without removing it.
 public T peek(int n) 
    Returns the n'th item down (zero-relative) from the top of this stack without removing it.
 public T pop() 
    Pops the top item off of this stack and return it.
 public T push(T 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(T 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.