--- jsr166/src/main/java/util/AbstractQueue.java 2003/05/18 18:10:02 1.1 +++ jsr166/src/main/java/util/AbstractQueue.java 2003/07/28 16:00:19 1.7 @@ -1,3 +1,9 @@ +/* + * Written by Doug Lea with assistance from members of JCP JSR-166 + * Expert Group and released to the public domain. Use, modify, and + * redistribute this code in any way without acknowledgement. + */ + package java.util; /** @@ -5,8 +11,11 @@ package java.util; * element based on offer, poll, and peek, respectively but that throw * exceptions instead of indicating failure via false or null returns. * The provided implementations all assume that the base implementation - * does not allow null elements. + * does not allow null elements. + * @since 1.5 + * @author Doug Lea */ + public abstract class AbstractQueue extends AbstractCollection implements Queue { public boolean add(E x) { @@ -16,7 +25,7 @@ public abstract class AbstractQueue e throw new IllegalStateException("Queue full"); } - public E remove() { + public E remove() throws NoSuchElementException { E x = poll(); if (x != null) return x; @@ -24,7 +33,7 @@ public abstract class AbstractQueue e throw new NoSuchElementException(); } - public E element() { + public E element() throws NoSuchElementException { E x = peek(); if (x != null) return x; @@ -37,4 +46,11 @@ public abstract class AbstractQueue e ; } + // XXX Remove this redundant declaration, pending response from Neal Gafter. + public abstract Iterator iterator(); } + + + + +