1 |
|
/* |
2 |
|
* %W% %E% |
3 |
|
* |
4 |
< |
* Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
4 |
> |
* Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
5 |
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
6 |
|
*/ |
7 |
|
|
52 |
|
* ({@code peek}, {@code element}, and {@code size}). |
53 |
|
* |
54 |
|
* <p>This class is a member of the |
55 |
< |
* <a href="{@docRoot}/../guide/collections/index.html"> |
55 |
> |
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
56 |
|
* Java Collections Framework</a>. |
57 |
|
* |
58 |
|
* @since 1.5 |
688 |
|
// Write out array length, for compatibility with 1.5 version |
689 |
|
s.writeInt(Math.max(2, size + 1)); |
690 |
|
|
691 |
< |
// Write out all elements in the proper order. |
691 |
> |
// Write out all elements in the "proper order". |
692 |
|
for (int i = 0; i < size; i++) |
693 |
|
s.writeObject(queue[i]); |
694 |
|
} |
709 |
|
|
710 |
|
queue = new Object[size]; |
711 |
|
|
712 |
< |
// Read in all elements in the proper order. |
712 |
> |
// Read in all elements. |
713 |
|
for (int i = 0; i < size; i++) |
714 |
|
queue[i] = s.readObject(); |
715 |
+ |
|
716 |
+ |
// Elements are guaranteed to be in "proper order", but the |
717 |
+ |
// spec has never explained what that might be. |
718 |
+ |
heapify(); |
719 |
|
} |
720 |
|
} |