/** * The core stack operations. Designed to support both static and * dynamic stacks. Uses the same names as the linear operations. * Adds a policy: the element removed and returned by get and peek * is the most-recently-added element. That is, stacks use a * "last in, first out" policy. Note that each method listed below * maintains the preconditions and postconditions given in * Linear.java. * * @author Samuel A. Rebelsky * @version 1.0 of April 1999 */ public interface Stack extends Linear { /** * Delete and return an element. * Post: Returns and deletes the most-recently-added element. */ public Object get(); /** * Determine the next object we will get when we call get. * Post: Returns the most-recently-added element. */ public Object peek(); } // interface Stack