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.108 by jsr166, Sun Oct 11 00:50:06 2015 UTC vs.
Revision 1.112 by jsr166, Tue Nov 29 18:11:28 2016 UTC

# Line 54 | Line 54 | import java.util.function.Consumer;
54   * <p>This class and its iterator implement all of the
55   * <em>optional</em> methods of the {@link Collection} and {@link
56   * Iterator} interfaces.  The Iterator provided in method {@link
57 < * #iterator()} is <em>not</em> guaranteed to traverse the elements of
57 > * #iterator()} and the Spliterator provided in method {@link #spliterator()}
58 > * are <em>not</em> guaranteed to traverse the elements of
59   * the priority queue in any particular order. If you need ordered
60   * traversal, consider using {@code Arrays.sort(pq.toArray())}.
61   *
# Line 337 | Line 338 | public class PriorityQueue<E> extends Ab
338          int i = size;
339          if (i >= queue.length)
340              grow(i + 1);
341 +        siftUp(i, e);
342          size = i + 1;
341        if (i == 0)
342            queue[0] = e;
343        else
344            siftUp(i, e);
343          return true;
344      }
345  
# Line 729 | Line 727 | public class PriorityQueue<E> extends Ab
727      /**
728       * Establishes the heap invariant (described above) in the entire tree,
729       * assuming nothing about the order of the elements prior to the call.
730 +     * This classic algorithm due to Floyd (1964) is known to be O(size).
731       */
732      @SuppressWarnings("unchecked")
733      private void heapify() {
# Line 752 | Line 751 | public class PriorityQueue<E> extends Ab
751      /**
752       * Saves this queue to a stream (that is, serializes it).
753       *
754 +     * @param s the stream
755 +     * @throws java.io.IOException if an I/O error occurs
756       * @serialData The length of the array backing the instance is
757       *             emitted (int), followed by all of its elements
758       *             (each an {@code Object}) in the proper order.
758     * @param s the stream
759     * @throws java.io.IOException if an I/O error occurs
759       */
760      private void writeObject(java.io.ObjectOutputStream s)
761          throws java.io.IOException {
# Line 802 | Line 801 | public class PriorityQueue<E> extends Ab
801      /**
802       * Creates a <em><a href="Spliterator.html#binding">late-binding</a></em>
803       * and <em>fail-fast</em> {@link Spliterator} over the elements in this
804 <     * queue.
804 >     * queue. The spliterator does not traverse elements in any particular order
805 >     * (the {@link Spliterator#ORDERED ORDERED} characteristic is not reported).
806       *
807       * <p>The {@code Spliterator} reports {@link Spliterator#SIZED},
808       * {@link Spliterator#SUBSIZED}, and {@link Spliterator#NONNULL}.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines