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.57 by jsr166, Mon Nov 28 02:44:06 2005 UTC vs.
Revision 1.62 by jsr166, Thu Feb 16 08:17:21 2006 UTC

# Line 1 | Line 1
1   /*
2   * %W% %E%
3   *
4 < * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
4 > * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5   * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6   */
7  
8   package java.util;
9 import java.util.*; // for javadoc (till 6280605 is fixed)
9  
10   /**
11   * An unbounded priority {@linkplain Queue queue} based on a priority
# Line 56 | Line 55 | import java.util.*; // for javadoc (till
55   * <a href="{@docRoot}/../guide/collections/index.html">
56   * Java Collections Framework</a>.
57   * @since 1.5
58 < * @version 1.8, 08/27/05
58 > * @version %I%, %G%
59   * @author Josh Bloch
60   * @param <E> the type of elements held in this collection
61   */
# Line 229 | Line 228 | public class PriorityQueue<E> extends Ab
228          // Double size if small; else grow by 50%
229          int newCapacity = ((oldCapacity < 64)?
230                             ((oldCapacity + 1) * 2):
231 <                           ((oldCapacity * 3) / 2));
231 >                           ((oldCapacity / 2) * 3));
232 >        if (newCapacity < 0) // overflow
233 >            newCapacity = Integer.MAX_VALUE;
234          if (newCapacity < minCapacity)
235              newCapacity = minCapacity;
236          queue = Arrays.copyOf(queue, newCapacity);
# Line 309 | Line 310 | public class PriorityQueue<E> extends Ab
310  
311      /**
312       * Version of remove using reference equality, not equals.
313 <     * Needed by iterator.remove
313 >     * Needed by iterator.remove.
314       *
315       * @param o element to be removed from this queue, if present
316 <     * @return <tt>true</tt> if removed.
316 >     * @return <tt>true</tt> if removed
317       */
318      boolean removeEq(Object o) {
319          for (int i = 0; i < size; i++) {
# Line 344 | Line 345 | public class PriorityQueue<E> extends Ab
345       * maintained by this list.  (In other words, this method must allocate
346       * a new array).  The caller is thus free to modify the returned array.
347       *
348 <     * @return an array containing all of the elements in this queue.
348 >     * @return an array containing all of the elements in this queue
349       */
350      public Object[] toArray() {
351          return Arrays.copyOf(queue, size);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines