org.exolab.castor.util
Class SafeStack<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<E>
              extended by java.util.Stack<E>
                  extended by org.exolab.castor.util.SafeStack<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess

public class SafeStack<E>
extends java.util.Stack<E>

The Stack.search(java.lang.Object) method of Stack can throw a ClassCastException if the items on the stack are not all the same type. We override that method so it compares on identity and not using equals().

Version:
$Revision: 0000 $ $Date: $
Author:
Edward Kuns
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SafeStack()
           
 
Method Summary
 int search(java.lang.Object object)
          
Searches for the given Object in the stack and returns its position relative to the top of the Stack (ie the number of calls to #pop() before the object is returned by #pop())
 
Methods inherited from class java.util.Stack
empty, peek, pop, push
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SafeStack

public SafeStack()
Method Detail

search

public int search(java.lang.Object object)

Searches for the given Object in the stack and returns its position relative to the top of the Stack (ie the number of calls to #pop() before the object is returned by #pop())

Overrides:
search in class java.util.Stack<E>


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com