Queue.java

Download
1/*2 * Queue.java3 * 4 * Computer Science S-22, Harvard University5 */6 7/*8 * A generic interface that defines a simple ADT for a queue of9 * objects of a particular type T.10 */11public interface Queue<T> {12    /* 13     * adds the specified item to the rear of the queue.  Returns false14     * if the list is full, and true otherwise.15     */16    boolean insert(T item);17 18    /* 19     * removes the item at the front of the queue and returns a20     * reference to the removed object.  Returns null is the queue is21     * empty.22     */23    T remove();24 25    /* 26     * returns a reference to the item at the front of the queue without27     * removing it. Returns null is the queue is empty.28     */29    T peek();30 31    /* returns true if the queue is empty, and false otherwise */32    boolean isEmpty();33 34    /* returns true if the queue is full, and false otherwise */35    boolean isFull();36}