text: public T remove(int index) {if (index == size - 1) {T[] blockRef = directory[toDirectoryIndex(index)];int blockIdx = toBlockIndex(index);T old = blockRef[blockIdx];blockRef[blockIdx] = null;size--;if (0 < tailBlkIdx)tailBlkIdx--;elseresetTailBlock();return old;} else if (index < 0 || size <= index) {throw new IndexOutOfBoundsException(String.valueOf(index));} else {T old = get(index);for (; index < size - 1; index++)set(index, get(index + 1));set(size - 1, null);size--;resetTailBlock();return old;}}