code: @Override
      @SuppressWarnings("unchecked")
      protected void ensureCapacity(int capacity) {
          checkCapacity(capacity);
          K[] newArray = (K[]) new Object[capacity + 1];
          System.arraycopy(array, 1, newArray, 1, size);
          array = newArray;
      }
docs: Ensure that the array representation has the necessary capacity.
  
  @param capacity
  the requested capacity