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.115 by jsr166, Fri Dec 2 07:11:36 2016 UTC vs.
Revision 1.118 by jsr166, Thu Dec 29 23:14:34 2016 UTC

# Line 522 | Line 522 | public class PriorityQueue<E> extends Ab
522           */
523          private int expectedModCount = modCount;
524  
525 +        Itr() {}                        // prevent access constructor creation
526 +
527          public boolean hasNext() {
528              return cursor < size ||
529                  (forgetMeNot != null && !forgetMeNot.isEmpty());
# Line 631 | Line 633 | public class PriorityQueue<E> extends Ab
633       * promoting x up the tree until it is greater than or equal to
634       * its parent, or is the root.
635       *
636 <     * To simplify and speed up coercions and comparisons. the
636 >     * To simplify and speed up coercions and comparisons, the
637       * Comparable and Comparator versions are separated into different
638       * methods that are otherwise identical. (Similarly for siftDown.)
639       *
# Line 732 | Line 734 | public class PriorityQueue<E> extends Ab
734      @SuppressWarnings("unchecked")
735      private void heapify() {
736          final Object[] es = queue;
737 <        final int half = (size >>> 1) - 1;
737 >        int i = (size >>> 1) - 1;
738          if (comparator == null)
739 <            for (int i = half; i >= 0; i--)
739 >            for (; i >= 0; i--)
740                  siftDownComparable(i, (E) es[i]);
741          else
742 <            for (int i = half; i >= 0; i--)
742 >            for (; i >= 0; i--)
743                  siftDownUsingComparator(i, (E) es[i]);
744      }
745  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines