/** * A (real) Stack Interface. * * Differs from the Java class Stack because it really is a stack; * differs slightly from the Koffman/Wolfgang book implementation in * that push() here has void return type. * * David Liben-Nowell * CS127 (Carleton College, Winter 2006) */ public interface RealStack { /** * Inserts an item into the stack. */ void push(E item); /** * Returns the most recently inserted object still in the stack. * The stack itself is unchanged. Throws an EmptyStackException if * the stack is empty. */ E peek(); /** * Removes the most recently inserted object still in the stack, and * returns it. Throws an EmptyStackException if the stack is empty. */ E pop(); /** * Returns true if and only if there are no elements left in the stack. */ boolean empty(); }