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.39 by jsr166, Fri Dec 2 06:38:56 2016 UTC

# Line 1169 | Line 1169 | public class Vector<E>
1169      }
1170  
1171      /**
1172 <     * Save the state of the {@code Vector} instance to a stream (that
1173 <     * is, serialize it).
1172 >     * Saves the state of the {@code Vector} instance to a stream
1173 >     * (that is, serializes it).
1174       * This method performs synchronization to ensure the consistency
1175       * of the serialized data.
1176 +     *
1177 +     * @param s the stream
1178 +     * @throws java.io.IOException if an I/O error occurs
1179       */
1180      private void writeObject(java.io.ObjectOutputStream s)
1181              throws java.io.IOException {
# Line 1452 | Line 1455 | public class Vector<E>
1455  
1456          @SuppressWarnings("unchecked")
1457          public void forEachRemaining(Consumer<? super E> action) {
1455            int i, hi; // hoist accesses and checks from loop
1456            Object[] a;
1458              if (action == null)
1459                  throw new NullPointerException();
1460 <            if ((hi = fence) < 0) {
1461 <                synchronized (Vector.this) {
1462 <                    expectedModCount = modCount;
1463 <                    a = array = elementData;
1464 <                    hi = fence = elementCount;
1465 <                }
1466 <            }
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();
1460 >            final int hi = getFence();
1461 >            final Object[] a = array;
1462 >            int i;
1463 >            for (i = index, index = hi; i < hi; i++)
1464 >                action.accept((E) a[i]);
1465 >            if (modCount != expectedModCount)
1466 >                throw new ConcurrentModificationException();
1467          }
1468  
1469          public long estimateSize() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines