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.18 by dholmes, Mon Aug 4 01:48:39 2003 UTC vs.
Revision 1.19 by tim, Mon Aug 4 16:14:48 2003 UTC

# Line 3 | Line 3
3   /**
4   * A 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 java.util.TreeSet} and
6 > * specified in the same manner as {@link java.util.TreeSet} and
7   * {@link java.util.TreeMap}: elements are ordered
8   * either according to their <i>natural order</i> (see {@link Comparable}), or
9 < * according to a {@link java.util.Comparator}, depending on which
9 > * according to a {@link java.util.Comparator}, depending on which
10   * constructor is used.
11 < * <p>The <em>head</em> of this queue is the <em>least</em> element with
12 < * respect to the specified ordering.
11 > * <p>The <em>head</em> of this queue is the <em>least</em> element with
12 > * respect to the specified ordering.
13   * If multiple elements are tied for least value, the
14   * head is one of those elements. A priority queue does not permit
15   * <tt>null</tt> elements.
# Line 22 | Line 22
22   *
23   * <p>A priority queue has a <i>capacity</i>.  The capacity is the
24   * size of the array used internally to store the elements on the
25 < * queue, and is limited to <tt>Integer.MAX_VALUE-1</tt>.  
25 > * queue, and is limited to <tt>Integer.MAX_VALUE-1</tt>.
26   * It is always at least as large as the queue size.  As
27   * elements are added to a priority queue, its capacity grows
28   * automatically.  The details of the growth policy are not specified.
# Line 118 | Line 118 | public class PriorityQueue<E> extends Ab
118      /**
119       * Create a <tt>PriorityQueue</tt> containing the elements in the specified
120       * collection.  The priority queue has an initial capacity of 110% of the
121 <     * size of the specified collection (bounded by
122 <     * <tt>Integer.MAX_VALUE-1</tt>); or 1 if the collection is empty.
121 >     * size of the specified collection (bounded by
122 >     * <tt>Integer.MAX_VALUE-1</tt>); or 1 if the collection is empty.
123       * If the specified collection
124       * implements the {@link Sorted} interface, the priority queue will be
125       * sorted according to the same comparator, or according to its elements'
# Line 145 | Line 145 | public class PriorityQueue<E> extends Ab
145  
146          this.queue = new Object[initialCapacity + 1];
147  
148 <        // FIXME: if c is larger than Integer.MAX_VALUE we'll
148 >        // FIXME: if c is larger than Integer.MAX_VALUE we'll
149          // overflow the array
150  
151          if (c instanceof Sorted) {
152 <            comparator = ((Sorted)c).comparator();
152 >            comparator = (Comparator<? super E>)((Sorted)c).comparator();
153          } else {
154              comparator = null;
155          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines