307 |
|
if (newSize > elementData.length) |
308 |
|
grow(newSize); |
309 |
|
final Object[] es = elementData; |
310 |
< |
for (int to = elementCount, i = elementCount = newSize; i < to; i++) |
310 |
> |
for (int to = elementCount, i = newSize; i < to; i++) |
311 |
|
es[i] = null; |
312 |
+ |
elementCount = newSize; |
313 |
|
} |
314 |
|
|
315 |
|
/** |
1455 |
|
|
1456 |
|
@SuppressWarnings("unchecked") |
1457 |
|
public boolean tryAdvance(Consumer<? super E> action) { |
1458 |
+ |
Objects.requireNonNull(action); |
1459 |
|
int i; |
1458 |
– |
if (action == null) |
1459 |
– |
throw new NullPointerException(); |
1460 |
|
if (getFence() > (i = index)) { |
1461 |
|
index = i + 1; |
1462 |
|
action.accept((E)array[i]); |
1469 |
|
|
1470 |
|
@SuppressWarnings("unchecked") |
1471 |
|
public void forEachRemaining(Consumer<? super E> action) { |
1472 |
< |
if (action == null) |
1473 |
< |
throw new NullPointerException(); |
1472 |
> |
Objects.requireNonNull(action); |
1473 |
|
final int hi = getFence(); |
1474 |
|
final Object[] a = array; |
1475 |
|
int i; |