12 |
|
import java.util.Collection; |
13 |
|
import java.util.Iterator; |
14 |
|
import java.util.NoSuchElementException; |
15 |
+ |
import java.util.Objects; |
16 |
|
import java.util.PriorityQueue; |
17 |
|
import java.util.concurrent.locks.Condition; |
18 |
|
import java.util.concurrent.locks.ReentrantLock; |
311 |
|
* @throws IllegalArgumentException {@inheritDoc} |
312 |
|
*/ |
313 |
|
public int drainTo(Collection<? super E> c) { |
314 |
< |
if (c == null) |
314 |
< |
throw new NullPointerException(); |
314 |
> |
Objects.requireNonNull(c); |
315 |
|
if (c == this) |
316 |
|
throw new IllegalArgumentException(); |
317 |
|
final ReentrantLock lock = this.lock; |
336 |
|
* @throws IllegalArgumentException {@inheritDoc} |
337 |
|
*/ |
338 |
|
public int drainTo(Collection<? super E> c, int maxElements) { |
339 |
< |
if (c == null) |
340 |
< |
throw new NullPointerException(); |
339 |
> |
Objects.requireNonNull(c); |
340 |
|
if (c == this) |
341 |
|
throw new IllegalArgumentException(); |
342 |
|
if (maxElements <= 0) |