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.9 by dl, Sun Nov 27 14:54:23 2005 UTC vs.
Revision 1.11 by jsr166, Mon Nov 28 03:59:23 2005 UTC

# Line 189 | Line 189 | public class ArrayList<E> extends Abstra
189       * @param minCapacity the desired minimum capacity
190       */
191      private void growArray(int minCapacity) {
192 <        if (minCapacity < 0)
192 >        if (minCapacity < 0)
193              throw new OutOfMemoryError(); // int overflow
194          int oldCapacity = elementData.length;
195          // Double size if small; else grow by 50%
# Line 414 | Line 414 | public class ArrayList<E> extends Abstra
414          modCount++;
415          if (s >= elementData.length)
416              growArray(s + 1);
417 <        System.arraycopy(elementData, index,
417 >        System.arraycopy(elementData, index,
418                           elementData, index + 1, s - index);
419          elementData[index] = element;
420          size = s + 1;
# Line 437 | Line 437 | public class ArrayList<E> extends Abstra
437          E oldValue = (E)elementData[index];
438          int numMoved = s - index;
439          if (numMoved > 0)
440 <            System.arraycopy(elementData, index + 1,
440 >            System.arraycopy(elementData, index + 1,
441                               elementData, index, numMoved);
442          elementData[s] = null;
443          size = s;
# Line 714 | Line 714 | public class ArrayList<E> extends Abstra
714                      throw new ConcurrentModificationException();
715              }
716          }
717 +
718          public E previous() {
719              try {
720                  int i = cursor - 1;
721 <                E next = get(i);
721 >                E prev = get(i);
722                  lastRet = i;
723                  cursor = i;
724 <                return next;
724 >                return prev;
725              } catch (IndexOutOfBoundsException ex) {
726                  throw new NoSuchElementException();
727              } finally {
# Line 758 | Line 759 | public class ArrayList<E> extends Abstra
759              expectedModCount = modCount;
760          }
761      }
761
762   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines