@Override
  public boolean addAll(Collection c) {
    Object[] a = c.toArray();
    int numNew = a.length;
    synchronized (lock) {
      int currentSize = size(); // byte to int
      ensureCapacity(currentSize + numNew);
      System.arraycopy(a, 0, elementData, currentSize, numNew);
      setSize(currentSize + numNew);
    }
    return numNew != 0;
  }
Checks if the given index is in range. If not, throws an appropriate runtime exception. This
method does *not* check if the index is negative: It is always used immediately prior to an
array access, which throws an ArrayIndexOutOfBoundsException if index is negative.
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/IndexElemArray.java