package username.linear; /** * A linear structure that follows the "first in, first out" policy. * * @author Samuel A. Rebelsky * @version 1.0 of March 2005 */ public interface Queue extends LinearStructure { /** * Add an element to the end of the queue. * * @param val * The object that is to be added. * @post * The queue now contains an additional copy of val. */ public void put(T val); /** * Remove the least-recently-added element that is still in the * queue. * * @return val * A value in the queue. * @pre * The queue is not empty. * @post * The queue contains one fewer copy of val. * @post * Every value in the queue was added more recently than val. */ public T get(); /** * Determine which object will next be returned by get. * * @return val * An object in the queue. * @pre * The queue is not empty. * @post * Every value in the queue was added less recently than val. */ public T peek(); /** * Determine if the queue is empty. */ public boolean isEmpty(); } // interface Queue