[cvs] / jsr166 / src / main / java / util / Vector.java Repository:
ViewVC logotype

Diff of /jsr166/src/main/java/util/Vector.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35, Sun Nov 13 21:07:40 2016 UTC revision 1.36, Mon Nov 14 22:46:22 2016 UTC
# Line 1006  Line 1006 
1006          int expectedModCount = modCount;          int expectedModCount = modCount;
1007          final Object[] es = elementData;          final Object[] es = elementData;
1008          final int end = elementCount;          final int end = elementCount;
         final boolean modified;  
1009          int i;          int i;
1010          // Optimize for initial run of survivors          // Optimize for initial run of survivors
1011          for (i = 0; i < end && !filter.test(elementAt(es, i)); i++)          for (i = 0; i < end && !filter.test(elementAt(es, i)); i++)
# Line 1014  Line 1013 
1013          // Tolerate predicates that reentrantly access the collection for          // Tolerate predicates that reentrantly access the collection for
1014          // read (but writers still get CME), so traverse once to find          // read (but writers still get CME), so traverse once to find
1015          // elements to delete, a second pass to physically expunge.          // elements to delete, a second pass to physically expunge.
1016          if (modified = (i < end)) {          if (i < end) {
             expectedModCount++;  
             modCount++;  
1017              final int beg = i;              final int beg = i;
1018              final long[] deathRow = nBits(end - beg);              final long[] deathRow = nBits(end - beg);
1019              deathRow[0] = 1L;   // set bit 0              deathRow[0] = 1L;   // set bit 0
1020              for (i = beg + 1; i < end; i++)              for (i = beg + 1; i < end; i++)
1021                  if (filter.test(elementAt(es, i)))                  if (filter.test(elementAt(es, i)))
1022                      setBit(deathRow, i - beg);                      setBit(deathRow, i - beg);
1023                if (modCount != expectedModCount)
1024                    throw new ConcurrentModificationException();
1025                expectedModCount++;
1026                modCount++;
1027              int w = beg;              int w = beg;
1028              for (i = beg; i < end; i++)              for (i = beg; i < end; i++)
1029                  if (isClear(deathRow, i - beg))                  if (isClear(deathRow, i - beg))
1030                      es[w++] = es[i];                      es[w++] = es[i];
1031              Arrays.fill(es, elementCount = w, end, null);              Arrays.fill(es, elementCount = w, end, null);
1032          }              // checkInvariants();
1033                return true;
1034            } else {
1035          if (modCount != expectedModCount)          if (modCount != expectedModCount)
1036              throw new ConcurrentModificationException();              throw new ConcurrentModificationException();
1037          // checkInvariants();          // checkInvariants();
1038          return modified;              return false;
1039            }
1040      }      }
1041    
1042      /**      /**

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8