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.60 by jsr166, Mon Dec 5 02:56:59 2005 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  
# Line 229 | Line 229 | public class PriorityQueue<E> extends Ab
229          // Double size if small; else grow by 50%
230          int newCapacity = ((oldCapacity < 64)?
231                             ((oldCapacity + 1) * 2):
232 <                           ((oldCapacity * 3) / 2));
232 >                           ((oldCapacity / 2) * 3));
233 >        if (newCapacity < 0) // overflow
234 >            newCapacity = Integer.MAX_VALUE;
235          if (newCapacity < minCapacity)
236              newCapacity = minCapacity;
237          queue = Arrays.copyOf(queue, newCapacity);
# Line 309 | Line 311 | public class PriorityQueue<E> extends Ab
311  
312      /**
313       * Version of remove using reference equality, not equals.
314 <     * Needed by iterator.remove
314 >     * Needed by iterator.remove.
315       *
316       * @param o element to be removed from this queue, if present
317 <     * @return <tt>true</tt> if removed.
317 >     * @return <tt>true</tt> if removed
318       */
319      boolean removeEq(Object o) {
320          for (int i = 0; i < size; i++) {
# Line 344 | Line 346 | public class PriorityQueue<E> extends Ab
346       * maintained by this list.  (In other words, this method must allocate
347       * a new array).  The caller is thus free to modify the returned array.
348       *
349 <     * @return an array containing all of the elements in this queue.
349 >     * @return an array containing all of the elements in this queue
350       */
351      public Object[] toArray() {
352          return Arrays.copyOf(queue, size);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines