Source of 8.14.java


  1: // @author Frank M. Carrano, Timothy M. Henry
  2: // @version 5.0
  3: public T dequeue()
  4: {
  5:    checkIntegrity();
  6:    if (isEmpty())
  7:       throw new EmptyQueueException();
  8:    else
  9:    {
 10:       T front = queue[frontIndex];
 11:       queue[frontIndex] = null;
 12:       frontIndex = (frontIndex + 1) % queue.length;
 13:       return front;
 14:    } // end if
 15: } // end dequeue