--- jsr166/src/main/java/util/AbstractQueue.java 2003/06/23 02:26:15 1.3 +++ jsr166/src/main/java/util/AbstractQueue.java 2003/09/26 11:37:06 1.18 @@ -7,22 +7,65 @@ package java.util; /** - * AbstractQueue provides default implementations of add, remove, and - * 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. + * This class provides skeletal implementations of some {@link Queue} + * operations. The implementations in this class are appropriate when + * the base implementation does not allow null + * elements. Methods {@link #add add}, {@link #remove remove}, and + * {@link #element element} are based on {@link #offer offer}, {@link + * #poll poll}, and {@link #peek peek}, respectively but throw + * exceptions instead of indicating failure via false or + * null returns. + * + *
A Queue implementation that extends this class must
+ * minimally define a method {@link Queue#offer} which does not permit
+ * insertion of null elements, along with methods {@link
+ * Queue#peek}, {@link Queue#poll}, {@link Collection#size}, and a
+ * {@link Collection#iterator} supporting {@link
+ * Iterator#remove}. Typically, additional methods will be overridden
+ * as well. If these requirements cannot be met, consider instead
+ * subclassing {@link AbstractCollection}.
+ *
+ * @since 1.5
+ * @author Doug Lea
*/
-
-public abstract class AbstractQueue This implementation repeatedly invokes {@link #poll poll} until it
+ * returns null.
+ */
public void clear() {
while (poll() != null)
;
}
-
}