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.9 by dl, Sun Jul 13 22:51:22 2003 UTC vs.
Revision 1.10 by tim, Sat Jul 26 13:17:51 2003 UTC

# Line 31 | Line 31
31   * @author Josh Bloch
32   */
33   public class PriorityQueue<E> extends AbstractQueue<E>
34 <                              implements Queue<E>,
34 >                              implements Queue<E>,
35                                           java.io.Serializable {
36      private static final int DEFAULT_INITIAL_CAPACITY = 11;
37  
# Line 97 | Line 97 | public class PriorityQueue<E> extends Ab
97      public PriorityQueue(int initialCapacity, Comparator<E> comparator) {
98          if (initialCapacity < 1)
99              initialCapacity = 1;
100 <        queue = new E[initialCapacity + 1];
100 >        queue = (E[]) new Object[initialCapacity + 1];
101          this.comparator = comparator;
102      }
103  
# Line 126 | Line 126 | public class PriorityQueue<E> extends Ab
126                                              Integer.MAX_VALUE - 1);
127          if (initialCapacity < 1)
128              initialCapacity = 1;
129 <        queue = new E[initialCapacity + 1];
129 >        queue = (E[]) new Object[initialCapacity + 1];
130  
131  
132          if (initialElements instanceof Sorted) {
# Line 217 | Line 217 | public class PriorityQueue<E> extends Ab
217       * elements of the priority queue will be returned by this iterator in the
218       * order specified by the queue, which is to say the order they would be
219       * returned by repeated calls to <tt>poll</tt>.
220 <     *
220 >     *
221       * @return an <tt>Iterator</tt> over the elements in this priority queue.
222       */
223      public Iterator<E> iterator() {
# Line 278 | Line 278 | public class PriorityQueue<E> extends Ab
278  
279      /**
280       * Returns the number of elements in this priority queue.
281 <     *
281 >     *
282       * @return the number of elements in this priority queue.
283       */
284      public int size() {
# Line 303 | Line 303 | public class PriorityQueue<E> extends Ab
303  
304          // Grow backing store if necessary
305          while (size >= queue.length) {
306 <            E[] newQueue = new E[2 * queue.length];
306 >            E[] newQueue = (E[]) new Object[2 * queue.length];
307              System.arraycopy(queue, 0, newQueue, 0, queue.length);
308              queue = newQueue;
309          }
# Line 451 | Line 451 | public class PriorityQueue<E> extends Ab
451  
452          // Read in array length and allocate array
453          int arrayLength = s.readInt();
454 <        queue = new E[arrayLength];
454 >        queue = (E[]) new Object[arrayLength];
455  
456          // Read in all elements in the proper order.
457          for (int i=0; i<size; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines