@Override
  public K remove(final int index) {
    if (index >= size) {
      throw new IndexOutOfBoundsException(
          "Index (" + index + ") is greater than or equal to list size (" + size + ")");
    }
    final K old = a[index];
    size--;
    if (index != size) {
      System.arraycopy(a, index + 1, a, index, size - index);
    }
    a[size] = null;
    assert !ASSERTS || size <= a.length;
    return old;
  }
Grows this array list, ensuring that it can contain the given number of entries without
resizing, and in case enlarging it at least by a factor of two.

@param capacity the new minimum capacity for this array list.
geode-core/src/main/java/org/apache/geode/internal/cache/IdentityArrayList.java