net.cscott.jutil
public class UniqueStack<E> extends UniqueVector<E>
Conforms to the JDK 1.2 Collections API.
Version: $Id: UniqueStack.java,v 1.3 2006-10-30 19:58:07 cananian Exp $
Constructor Summary | |
---|---|
UniqueStack() Creates a UniqueStack. | |
UniqueStack(Collection<? extends E> c) Constructs a UniqueStack containing the elements of
the specified Collection, in the order they are returned
by the collection's iterator in LIFO order. |
Method Summary | |
---|---|
boolean | empty()
Tests if this stack is empty. |
E | peek()
Looks at the object at the top of this stack without removing it
from the stack. |
E | pop()
Removes the object at the top of this stack and returns that
object as the value of this function. |
void | push(E item)
Pushes an item onto the top of this stack, if it is unique.
|
int | search(Object o)
Returns where an object is on this stack. |
c
are skipped.Returns: true
if this stack is empty;
false
otherwise.
Returns: the object at the top of this stack.
Throws: EmptyStackException if this stack is empty.
Returns: The object at the top of this stack.
Throws: EmptyStackException if this empty.
Parameters: item the item to be pushed onto this stack.
Parameters: o the desired object.
Returns: the distance from the top of the stack where the object is
located; the return value -1
indicates that the
object is not on the stack.