--- jsr166/src/main/java/util/PriorityQueue.java 2006/03/07 07:11:39 1.63 +++ jsr166/src/main/java/util/PriorityQueue.java 2007/05/20 07:54:01 1.67 @@ -1,8 +1,26 @@ /* - * %W% %E% + * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. */ package java.util; @@ -52,7 +70,7 @@ package java.util; * ({@code peek}, {@code element}, and {@code size}). * *

This class is a member of the - * + * * Java Collections Framework. * * @since 1.5 @@ -688,7 +706,7 @@ public class PriorityQueue extends Ab // Write out array length, for compatibility with 1.5 version s.writeInt(Math.max(2, size + 1)); - // Write out all elements in the proper order. + // Write out all elements in the "proper order". for (int i = 0; i < size; i++) s.writeObject(queue[i]); } @@ -709,8 +727,12 @@ public class PriorityQueue extends Ab queue = new Object[size]; - // Read in all elements in the proper order. + // 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(); } }