13 |
|
import java.util.Collection; |
14 |
|
import java.util.Iterator; |
15 |
|
import java.util.NoSuchElementException; |
16 |
+ |
import java.util.Objects; |
17 |
|
import java.util.Queue; |
18 |
|
import java.util.Spliterator; |
19 |
|
import java.util.Spliterators; |
878 |
|
*/ |
879 |
|
@SuppressWarnings("unchecked") |
880 |
|
public <T> T[] toArray(T[] a) { |
881 |
< |
if (a == null) throw new NullPointerException(); |
881 |
> |
Objects.requireNonNull(a); |
882 |
|
return (T[]) toArrayInternal(a); |
883 |
|
} |
884 |
|
|
1020 |
|
|
1021 |
|
@SuppressWarnings("unchecked") |
1022 |
|
public void forEachRemaining(Consumer<? super E> action) { |
1023 |
+ |
Objects.requireNonNull(action); |
1024 |
|
Node p; |
1023 |
– |
if (action == null) throw new NullPointerException(); |
1025 |
|
if (!exhausted && |
1026 |
|
((p = current) != null || (p = firstDataNode()) != null)) { |
1027 |
|
current = null; |
1042 |
|
|
1043 |
|
@SuppressWarnings("unchecked") |
1044 |
|
public boolean tryAdvance(Consumer<? super E> action) { |
1045 |
+ |
Objects.requireNonNull(action); |
1046 |
|
Node p; |
1045 |
– |
if (action == null) throw new NullPointerException(); |
1047 |
|
if (!exhausted && |
1048 |
|
((p = current) != null || (p = firstDataNode()) != null)) { |
1049 |
|
Object item; |
1318 |
|
* @throws IllegalArgumentException {@inheritDoc} |
1319 |
|
*/ |
1320 |
|
public int drainTo(Collection<? super E> c) { |
1321 |
< |
if (c == null) |
1321 |
< |
throw new NullPointerException(); |
1321 |
> |
Objects.requireNonNull(c); |
1322 |
|
if (c == this) |
1323 |
|
throw new IllegalArgumentException(); |
1324 |
|
int n = 0; |
1334 |
|
* @throws IllegalArgumentException {@inheritDoc} |
1335 |
|
*/ |
1336 |
|
public int drainTo(Collection<? super E> c, int maxElements) { |
1337 |
< |
if (c == null) |
1338 |
< |
throw new NullPointerException(); |
1337 |
> |
Objects.requireNonNull(c); |
1338 |
|
if (c == this) |
1339 |
|
throw new IllegalArgumentException(); |
1340 |
|
int n = 0; |