code: private void checkIndex(int index)
    {
      if (index < 0) {
        throw new IAE("Index[%s] < 0", index);
      }
      if (index >= size) {
        throw new IAE("Index[%d] >= size[%d]", index, size);
      }
    }
docs: Checks  if {@code index} a valid `element index` in GenericIndexed.
  Similar to Preconditions.checkElementIndex() except this method throws {@link IAE} with custom error message.
  <p>
  Used here to get existing behavior(same error message and exception) of V1 GenericIndexed.
  
  @param index index identifying an element of an GenericIndexed.