--- jsr166/src/main/java/util/PriorityQueue.java 2003/09/15 12:02:23 1.42 +++ jsr166/src/main/java/util/PriorityQueue.java 2004/05/27 11:05:44 1.49 @@ -1,7 +1,7 @@ /* * %W% %E% * - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ @@ -15,7 +15,7 @@ package java.util; * {@link java.util.Comparator}, depending on which constructor is * used. A priority queue does not permit null elements. * A priority queue relying on natural ordering also does not - * permit insertion of non-comparable objects (doing so results + * permit insertion of non-comparable objects (doing so may result * in ClassCastException). * *

The head of this queue is the least element @@ -59,9 +59,10 @@ package java.util; * @since 1.5 * @version %I%, %G% * @author Josh Bloch + * @param the type of elements held in this collection */ public class PriorityQueue extends AbstractQueue - implements Queue, java.io.Serializable { + implements java.io.Serializable { private static final long serialVersionUID = -7720805057305804111L; @@ -198,8 +199,7 @@ public class PriorityQueue extends Ab public PriorityQueue(Collection c) { initializeArray(c); if (c instanceof SortedSet) { - // @fixme double-cast workaround for compiler - SortedSet s = (SortedSet) (SortedSet)c; + SortedSet s = (SortedSet)c; comparator = (Comparator)s.comparator(); fillFromSorted(s); } else if (c instanceof PriorityQueue) { @@ -325,6 +325,10 @@ public class PriorityQueue extends Ab return offer(o); } + /** + * Removes a single instance of the specified element from this + * collection, if it is present. + */ public boolean remove(Object o) { if (o == null) return false; @@ -456,7 +460,8 @@ public class PriorityQueue extends Ab } /** - * Remove all elements from the priority queue. + * Removes all elements from the priority queue. + * The queue will be empty after this call returns. */ public void clear() { modCount++;