--- jsr166/src/main/java/util/PriorityQueue.java 2007/05/20 07:54:01 1.67 +++ jsr166/src/main/java/util/PriorityQueue.java 2008/05/18 23:59:57 1.69 @@ -74,7 +74,6 @@ package java.util; * Java Collections Framework. * * @since 1.5 - * @version %I%, %G% * @author Josh Bloch, Doug Lea * @param the type of elements held in this collection */ @@ -244,7 +243,7 @@ public class PriorityQueue extends Ab private void grow(int minCapacity) { if (minCapacity < 0) // overflow throw new OutOfMemoryError(); - int oldCapacity = queue.length; + int oldCapacity = queue.length; // Double size if small; else grow by 50% int newCapacity = ((oldCapacity < 64)? ((oldCapacity + 1) * 2): @@ -300,7 +299,7 @@ public class PriorityQueue extends Ab } private int indexOf(Object o) { - if (o != null) { + if (o != null) { for (int i = 0; i < size; i++) if (o.equals(queue[i])) return i; @@ -320,13 +319,13 @@ public class PriorityQueue extends Ab * @return {@code true} if this queue changed as a result of the call */ public boolean remove(Object o) { - int i = indexOf(o); - if (i == -1) - return false; - else { - removeAt(i); - return true; - } + int i = indexOf(o); + if (i == -1) + return false; + else { + removeAt(i); + return true; + } } /** @@ -337,8 +336,8 @@ public class PriorityQueue extends Ab * @return {@code true} if removed */ boolean removeEq(Object o) { - for (int i = 0; i < size; i++) { - if (o == queue[i]) { + for (int i = 0; i < size; i++) { + if (o == queue[i]) { removeAt(i); return true; } @@ -355,7 +354,7 @@ public class PriorityQueue extends Ab * @return {@code true} if this queue contains the specified element */ public boolean contains(Object o) { - return indexOf(o) != -1; + return indexOf(o) != -1; } /** @@ -416,7 +415,7 @@ public class PriorityQueue extends Ab if (a.length < size) // Make a new array of a's runtime type, but my contents: return (T[]) Arrays.copyOf(queue, size, a.getClass()); - System.arraycopy(queue, 0, a, 0, size); + System.arraycopy(queue, 0, a, 0, size); if (a.length > size) a[size] = null; return a; @@ -509,7 +508,7 @@ public class PriorityQueue extends Ab lastRetElt = null; } else { throw new IllegalStateException(); - } + } expectedModCount = modCount; } } @@ -725,14 +724,14 @@ public class PriorityQueue extends Ab // Read in (and discard) array length s.readInt(); - queue = new Object[size]; + queue = new Object[size]; // Read in all elements. for (int i = 0; i < size; i++) queue[i] = s.readObject(); - // Elements are guaranteed to be in "proper order", but the - // spec has never explained what that might be. - heapify(); + // Elements are guaranteed to be in "proper order", but the + // spec has never explained what that might be. + heapify(); } }