--- jsr166/src/main/java/util/PriorityQueue.java 2005/11/28 02:44:06 1.57 +++ jsr166/src/main/java/util/PriorityQueue.java 2005/11/28 23:53:32 1.58 @@ -229,7 +229,9 @@ public class PriorityQueue extends Ab // Double size if small; else grow by 50% int newCapacity = ((oldCapacity < 64)? ((oldCapacity + 1) * 2): - ((oldCapacity * 3) / 2)); + ((oldCapacity / 2) * 3)); + if (newCapacity < 0) // overflow + newCapacity = Integer.MAX_VALUE; if (newCapacity < minCapacity) newCapacity = minCapacity; queue = Arrays.copyOf(queue, newCapacity);