--- jsr166/src/main/java/util/AbstractQueue.java 2003/05/18 18:10:02 1.1 +++ jsr166/src/main/java/util/AbstractQueue.java 2003/07/31 07:18:02 1.9 @@ -1,21 +1,67 @@ +/* + * 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; /** - * 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. + * AbstractQueue provides default implementations of + * {@link #add add}, {@link #remove remove}, and {@link #element element} + * based on + * {@link #offer offer}, {@link #poll poll}, and {@link #peek 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.
+ * @since 1.5
+ * @author Doug Lea
*/
-public abstract class AbstractQueue
+ * This implementation iterates over the specified collection, and adds
+ * each object returned by the iterator to this collection, in turn.
+ *
+ * @param c collection whose elements are to be added to this queue
+ * @return true if this collection changed as a result of the
+ * call.
+ * @throws NullPointerException if c is null
+ *
+ */
+ boolean addAll(Collection extends E> c) {
+ return super.addAll(c);
+ }
+
+ /** @throws NoSuchElementException {@inheritDoc} */
public E remove() {
E x = poll();
if (x != null)
@@ -24,6 +70,7 @@ public abstract class AbstractQueue This implementation repeatedly invokes {@link #poll poll} until it
+ * returns null.
+ */
public void clear() {
while (poll() != null)
;
}
+ // XXX Remove this redundant declaration, pending response from Neal Gafter.
+ public abstract Iterator