Class SafeStack<E>

All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess

public class SafeStack<E> extends 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:
  • Constructor Details

    • SafeStack

      public SafeStack()
  • Method Details

    • search

      public int search(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 Stack<E>