ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/PriorityQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/PriorityQueue.java (file contents):
Revision 1.11 by dholmes, Mon Jul 28 04:11:54 2003 UTC vs.
Revision 1.14 by tim, Mon Jul 28 16:00:19 2003 UTC

# Line 3 | Line 3
3   /**
4   * An unbounded priority queue based on a priority heap.  This queue orders
5   * elements according to an order specified at construction time, which is
6 < * specified in the same manner as {@link TreeSet} and {@link TreeMap}:
6 > * specified in the same manner as {@link TreeSet} and {@link TreeMap}:
7   * elements are ordered
8   * either according to their <i>natural order</i> (see {@link Comparable}), or
9   * according to a {@link Comparator}, depending on which constructor is used.
10   * The <em>head</em> of this queue is the least element with respect to the
11 < * specified ordering. If multiple elements are tied for least value, the
12 < * head is one of those elements. A priority queue does not permit
11 > * specified ordering. If multiple elements are tied for least value, the
12 > * head is one of those elements. A priority queue does not permit
13   * <tt>null</tt> elements.
14 < *
14 > *
15   * <p>The {@link #remove()} and {@link #poll()} methods remove and
16   * return the head of the queue.
17   *
# Line 38 | Line 38
38   * @author Josh Bloch
39   */
40   public class PriorityQueue<E> extends AbstractQueue<E>
41 <    implements Queue<E>, Sorted, java.io.Serializable {
41 >    implements Queue<E>, java.io.Serializable {
42  
43      private static final int DEFAULT_INITIAL_CAPACITY = 11;
44  
# Line 202 | Line 202 | public class PriorityQueue<E> extends Ab
202      /**
203       * @throws NullPointerException if any element is <tt>null</tt>.
204       */
205 <    public boolean addAll(Collection c) {
205 >    public boolean addAll(Collection<? extends E> c) {
206          return super.addAll(c);
207      }
208  
209      /**
210       * @throws NullPointerException if the specified element is <tt>null</tt>.
211       */
212 <    public boolean remove(E o) {
212 >    public boolean remove(Object o) {
213          if (o == null)
214              throw new NullPointerException();
215  
# Line 222 | Line 222 | public class PriorityQueue<E> extends Ab
222              }
223          } else {
224              for (int i = 1; i <= size; i++) {
225 <                if (comparator.compare(queue[i], o) == 0) {
225 >                if (comparator.compare(queue[i], (E)o) == 0) {
226                      remove(i);
227                      return true;
228                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines