/** * Interface for a queue: a collection of objects * that are inserted and removed according to the * last-in first-out principle. */ public interface Queue { /** @return number of elements in the queue. */ public int size(); /** @return true if the queue is empty, false otherwise. */ public boolean isEmpty(); /** * Inspect the element at the front of the queue. * * @return element at the front of the queue. * @throws QueueEmptyException if the queue is empty. */ public Object front() throws QueueEmptyException; /** * Insert an element at the rear of the queue. * * @param element new element to be inserted. * @throws QueueFullException if the queue is full. */ public void enqueue (Object element) throws QueueFullException; /** * Remove the element at the front of the queue. * * @return element removed. * @throws QueueEmptyException if the queue is empty. */ public Object dequeue() throws QueueEmptyException; }