Package org.exolab.castor.util
Class SafeStack<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<E>
-
- java.util.Stack<E>
-
- 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>
TheStack.search(java.lang.Object)
method ofStack
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 usingequals()
.- Version:
- $Revision: 0000 $ $Date: $
- Author:
- Edward Kuns
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SafeStack()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
-
-
-
-
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 classjava.util.Stack<E>
-
-