1 |
|
/* |
2 |
< |
* Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. |
2 |
> |
* Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved. |
3 |
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
|
* |
5 |
|
* This code is free software; you can redistribute it and/or modify it |
70 |
|
* |
71 |
|
* <p>As of the Java 2 platform v1.2, this class was retrofitted to |
72 |
|
* implement the {@link List} interface, making it a member of the |
73 |
< |
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
73 |
> |
* <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework"> |
74 |
|
* Java Collections Framework</a>. Unlike the new collection |
75 |
|
* implementations, {@code Vector} is synchronized. If a thread-safe |
76 |
|
* implementation is not needed, it is recommended to use {@link |
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 |
|
/** |
986 |
|
return bulkRemove(e -> !c.contains(e)); |
987 |
|
} |
988 |
|
|
989 |
+ |
/** |
990 |
+ |
* @throws NullPointerException {@inheritDoc} |
991 |
+ |
*/ |
992 |
|
@Override |
993 |
|
public boolean removeIf(Predicate<? super E> filter) { |
994 |
|
Objects.requireNonNull(filter); |
1027 |
|
setBit(deathRow, i - beg); |
1028 |
|
if (modCount != expectedModCount) |
1029 |
|
throw new ConcurrentModificationException(); |
1026 |
– |
expectedModCount++; |
1030 |
|
modCount++; |
1031 |
|
int w = beg; |
1032 |
|
for (i = beg; i < end; i++) |
1356 |
|
} |
1357 |
|
} |
1358 |
|
|
1359 |
+ |
/** |
1360 |
+ |
* @throws NullPointerException {@inheritDoc} |
1361 |
+ |
*/ |
1362 |
|
@Override |
1363 |
|
public synchronized void forEach(Consumer<? super E> action) { |
1364 |
|
Objects.requireNonNull(action); |
1372 |
|
// checkInvariants(); |
1373 |
|
} |
1374 |
|
|
1375 |
+ |
/** |
1376 |
+ |
* @throws NullPointerException {@inheritDoc} |
1377 |
+ |
*/ |
1378 |
|
@Override |
1379 |
|
public synchronized void replaceAll(UnaryOperator<E> operator) { |
1380 |
|
Objects.requireNonNull(operator); |
1425 |
|
private int fence; // -1 until used; then one past last index |
1426 |
|
private int expectedModCount; // initialized when fence set |
1427 |
|
|
1428 |
< |
/** Create new spliterator covering the given range */ |
1428 |
> |
/** Creates new spliterator covering the given range. */ |
1429 |
|
VectorSpliterator(Object[] array, int origin, int fence, |
1430 |
|
int expectedModCount) { |
1431 |
|
this.array = array; |
1454 |
|
|
1455 |
|
@SuppressWarnings("unchecked") |
1456 |
|
public boolean tryAdvance(Consumer<? super E> action) { |
1457 |
+ |
Objects.requireNonNull(action); |
1458 |
|
int i; |
1449 |
– |
if (action == null) |
1450 |
– |
throw new NullPointerException(); |
1459 |
|
if (getFence() > (i = index)) { |
1460 |
|
index = i + 1; |
1461 |
|
action.accept((E)array[i]); |
1468 |
|
|
1469 |
|
@SuppressWarnings("unchecked") |
1470 |
|
public void forEachRemaining(Consumer<? super E> action) { |
1471 |
< |
if (action == null) |
1464 |
< |
throw new NullPointerException(); |
1471 |
> |
Objects.requireNonNull(action); |
1472 |
|
final int hi = getFence(); |
1473 |
|
final Object[] a = array; |
1474 |
|
int i; |