/** . . . @throws NoSuchElementException if queue is empty */ public Message remove() { if (count == 0) throw new NoSuchElementException(); Message r = elements[head]; . . . }
Exception throw part of the contract
Caller can rely on behavior
Exception throw not result of precondition violation