public class SafeStack<E> extends Stack<E>
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()
.capacityIncrement, elementCount, elementData
modCount
Constructor and Description |
---|
SafeStack() |
Modifier and Type | Method and Description |
---|---|
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()) |
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
finalize, getClass, notify, notifyAll, wait, wait, wait
parallelStream, stream
Copyright © 2015. All rights reserved.