// An interface for a stack. // Barry Cornelius, 19 June 2000 public interface Stack { // adds a new element (to the top of the target stack) that is // assigned the value pObject, a pointer to some object public void add(Object pObject); // returns a pointer to the object that is at the top element // of the target stack (without removing the element) public Object getFirst(); // returns a pointer to the object that is at the top element // of the target stack and removes that element from the stack public Object remove(); // returns the number of elements in the target stack public int size(); // returns the value true if and only if the objects of the // target stack and the stack passed as an argument have // the same values in the same order public boolean equals(Object pObject); // returns a hashcode value for the target stack public int hashCode(); // returns a textual representation of the target stack public String toString(); }