@Override
    @SuppressWarnings("unchecked")
    protected void ensureCapacity(int capacity) {
        checkCapacity(capacity);
        ArrayHandle[] newArray = (ArrayHandle[]) Array.newInstance(ArrayHandle.class, capacity + 1);
        System.arraycopy(array, 1, newArray, 1, size);
        array = newArray;
    }
@ Override @ SuppressWarnings ( "unchecked" ) protected void ensureCapacity ( int capacity ) { checkCapacity ( capacity ) ; ArrayHandle [ ] newArray = ( ArrayHandle [ ] ) Array . newInstance ( ArrayHandle . class , capacity + 1 ) ; System . arraycopy ( array , 1 , newArray , 1 , size ) ; array = newArray ; }
Ensure that the array representation has the necessary capacity.

@param capacity
the requested capacity