/** * Linear structures. Simple collections that provide the primary operations * of add() and get(). * * @author Samuel A. Rebelsky * @author Yvonne Palm */ public interface Linear { /** * Add something to the collection. */ public void add(Object thingy); /** * Get and remove something from the collection. * Produces: * thingy, an object. * Pre: * The collection is nonempty. * Post: * The collection will have one less element. * In particular, it will have one fewer copy of thingy. * No other elements are affected. */ public Object get() throws Exception; /** * Peek at the next thing that get() will return. */ public Object peek() throws Exception; /** * Determine if anything is left in the collection. */ public boolean isEmpty(); } // interface Linear()