ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/PriorityBlockingQueue.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/PriorityBlockingQueue.java (file contents):
Revision 1.123 by jsr166, Sat Dec 24 04:30:54 2016 UTC vs.
Revision 1.124 by jsr166, Sat Dec 24 19:32:07 2016 UTC

# Line 14 | Line 14 | import java.util.Collection;
14   import java.util.Comparator;
15   import java.util.Iterator;
16   import java.util.NoSuchElementException;
17 + import java.util.Objects;
18   import java.util.PriorityQueue;
19   import java.util.Queue;
20   import java.util.SortedSet;
# Line 701 | Line 702 | public class PriorityBlockingQueue<E> ex
702       * @throws IllegalArgumentException      {@inheritDoc}
703       */
704      public int drainTo(Collection<? super E> c, int maxElements) {
705 <        if (c == null)
705 <            throw new NullPointerException();
705 >        Objects.requireNonNull(c);
706          if (c == this)
707              throw new IllegalArgumentException();
708          if (maxElements <= 0)
# Line 931 | Line 931 | public class PriorityBlockingQueue<E> ex
931  
932          @SuppressWarnings("unchecked")
933          public void forEachRemaining(Consumer<? super E> action) {
934 +            Objects.requireNonNull(action);
935              Object[] a; int i, hi; // hoist accesses and checks from loop
935            if (action == null)
936                throw new NullPointerException();
936              if ((a = array) == null)
937                  fence = (a = toArray()).length;
938              if ((hi = fence) <= a.length &&
# Line 943 | Line 942 | public class PriorityBlockingQueue<E> ex
942          }
943  
944          public boolean tryAdvance(Consumer<? super E> action) {
945 <            if (action == null)
947 <                throw new NullPointerException();
945 >            Objects.requireNonNull(action);
946              if (getFence() > index && index >= 0) {
947                  @SuppressWarnings("unchecked") E e = (E) array[index++];
948                  action.accept(e);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines