@SuppressWarnings("unchecked")
  private void grow(final int capacity) {
    if (wrapped) {
      a = ObjectArrays.grow(a, capacity, size);
    } else {
      if (capacity > a.length) {
        final int newLength = (int) Math
            .max(Math.min(2L * a.length, it.unimi.dsi.fastutil.Arrays.MAX_ARRAY_SIZE), capacity);
        final Object[] t = new Object[newLength];
        System.arraycopy(a, 0, t, 0, size);
        a = (K[]) t;
      }
    }
    assert !ASSERTS || size <= a.length;
  }
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