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

Comparing jsr166/src/main/java/util/Vector.java (file contents):
Revision 1.37 by jsr166, Wed Nov 30 03:31:47 2016 UTC vs.
Revision 1.38 by jsr166, Thu Dec 1 00:35:21 2016 UTC

# Line 1452 | Line 1452 | public class Vector<E>
1452  
1453          @SuppressWarnings("unchecked")
1454          public void forEachRemaining(Consumer<? super E> action) {
1455            int i, hi; // hoist accesses and checks from loop
1456            Object[] a;
1455              if (action == null)
1456                  throw new NullPointerException();
1457 <            if ((hi = fence) < 0) {
1458 <                synchronized (Vector.this) {
1459 <                    expectedModCount = modCount;
1460 <                    a = array = elementData;
1461 <                    hi = fence = elementCount;
1462 <                }
1463 <            }
1466 <            else
1467 <                a = array;
1468 <            if (a != null && (i = index) >= 0 && (index = hi) <= a.length) {
1469 <                while (i < hi)
1470 <                    action.accept((E) a[i++]);
1471 <                if (modCount == expectedModCount)
1472 <                    return;
1473 <            }
1474 <            throw new ConcurrentModificationException();
1457 >            final int hi = getFence();
1458 >            final Object[] a = array;
1459 >            int i;
1460 >            for (i = index, index = hi; i < hi; i++)
1461 >                action.accept((E) a[i]);
1462 >            if (modCount != expectedModCount)
1463 >                throw new ConcurrentModificationException();
1464          }
1465  
1466          public long estimateSize() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines