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

Comparing jsr166/src/main/java/util/ArrayList.java (file contents):
Revision 1.52 by jsr166, Wed May 31 22:37:31 2017 UTC vs.
Revision 1.53 by jsr166, Mon Jul 3 20:08:10 2017 UTC

# Line 745 | Line 745 | public class ArrayList<E> extends Abstra
745                          final int from, final int end) {
746          Objects.requireNonNull(c);
747          final Object[] es = elementData;
748        final boolean modified;
748          int r;
749          // Optimize for initial run of survivors
750 <        for (r = from; r < end && c.contains(es[r]) == complement; r++)
751 <            ;
752 <        if (modified = (r < end)) {
753 <            int w = r++;
754 <            try {
755 <                for (Object e; r < end; r++)
756 <                    if (c.contains(e = es[r]) == complement)
757 <                        es[w++] = e;
758 <            } catch (Throwable ex) {
759 <                // Preserve behavioral compatibility with AbstractCollection,
760 <                // even if c.contains() throws.
761 <                System.arraycopy(es, r, es, w, end - r);
762 <                w += end - r;
763 <                throw ex;
764 <            } finally {
765 <                modCount += end - w;
766 <                shiftTailOverGap(es, w, end);
767 <            }
750 >        for (r = from;; r++) {
751 >            if (r == end)
752 >                return false;
753 >            if (c.contains(es[r]) != complement)
754 >                break;
755 >        }
756 >        int w = r++;
757 >        try {
758 >            for (Object e; r < end; r++)
759 >                if (c.contains(e = es[r]) == complement)
760 >                    es[w++] = e;
761 >        } catch (Throwable ex) {
762 >            // Preserve behavioral compatibility with AbstractCollection,
763 >            // even if c.contains() throws.
764 >            System.arraycopy(es, r, es, w, end - r);
765 >            w += end - r;
766 >            throw ex;
767 >        } finally {
768 >            modCount += end - w;
769 >            shiftTailOverGap(es, w, end);
770          }
771          // checkInvariants();
772 <        return modified;
772 >        return true;
773      }
774  
775      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines