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.32 by dl, Mon Aug 25 23:47:01 2003 UTC vs.
Revision 1.34 by dholmes, Wed Aug 27 01:33:50 2003 UTC

# Line 37 | Line 37
37   * Multiple threads should not access a <tt>PriorityQueue</tt>
38   * instance concurrently if any of the threads modifies the list
39   * structurally. Instead, use the thread-safe {@link
40 < * java.util.concurrent.BlockingPriorityQueue} class.
40 > * java.util.concurrent.PriorityBlockingQueue} class.
41   *
42   *
43   * <p>Implementation note: this implementation provides O(log(n)) time
# Line 517 | Line 517 | public class PriorityQueue<E> extends Ab
517      private void fixDown(int k) {
518          int j;
519          if (comparator == null) {
520 <            while ((j = k << 1) <= size && j > 0) {
520 >            while ((j = k << 1) <= size && (j > 0)) {
521                  if (j<size && ((Comparable<E>)queue[j]).compareTo((E)queue[j+1]) > 0)
522                      j++; // j indexes smallest kid
523                  if (((Comparable<E>)queue[k]).compareTo((E)queue[j]) <= 0)
# Line 526 | Line 526 | public class PriorityQueue<E> extends Ab
526                  k = j;
527              }
528          } else {
529 <            while ((j = k << 1) <= size && j > 0) {
529 >            while ((j = k << 1) <= size && (j > 0)) {
530                  if (j < size && comparator.compare((E)queue[j], (E)queue[j+1]) > 0)
531                      j++; // j indexes smallest kid
532                  if (comparator.compare((E)queue[k], (E)queue[j]) <= 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines