@Test public void testRemove() { int[] numbers = new int[10]; for (int i = 0; i < numbers.length; i++) { numbers[i] = i; list.add(i, i); } assertListValues(numbers); list.remove(1); list.remove(0); int[] remainingNumbers = Arrays.copyOfRange(numbers, 2, numbers.length); assertListValues(remainingNumbers); }
@Override public E remove(int index) { E old = get(index); while (index + 1 < size) { counter += 2; arr[index] = arr[index + 1]; index++; } counter++; arr[size] = null; size--; return old; }
SimpleArrayList extends AbstractList<E> implements List<E> { @Override public E remove(int index) { E old = get(index); while (index + 1 < size) { counter += 2; arr[index] = arr[index + 1]; index++; } counter++; arr[size] = null; size--; return old; } }
SimpleArrayList extends AbstractList<E> implements List<E> { @Override public E remove(int index) { E old = get(index); while (index + 1 < size) { counter += 2; arr[index] = arr[index + 1]; index++; } counter++; arr[size] = null; size--; return old; }  }
SimpleArrayList extends AbstractList<E> implements List<E> { @Override public E remove(int index) { E old = get(index); while (index + 1 < size) { counter += 2; arr[index] = arr[index + 1]; index++; } counter++; arr[size] = null; size--; return old; }  @Override int size(); @SuppressWarnings("unchecked") @Override E get(int index); @Override E set(int index, E element); @Override void add(int index, E element); @Override E remove(int index); long getCounter(); }
SimpleArrayList extends AbstractList<E> implements List<E> { @Override public E remove(int index) { E old = get(index); while (index + 1 < size) { counter += 2; arr[index] = arr[index + 1]; index++; } counter++; arr[size] = null; size--; return old; }  @Override int size(); @SuppressWarnings("unchecked") @Override E get(int index); @Override E set(int index, E element); @Override void add(int index, E element); @Override E remove(int index); long getCounter();  }