12.2 Daily

// Maximum index subscript = array length -1
int maxIdx = itemList.length-1;

// 从d的下标一直要到最大索引下标
for (int i = d; i <= maxIdx; i++) {
    // 如果当前值是null,就退出循环
    if (itemList[i] == null) {
        break;
    }

    // 判断当前的下标是否是最大索引下标
    if (i == maxIdx) {
        // 数组[d]=null
        itemList[i] = null;
        break;
    }

    // 上述情况都不满足,基本操作
    itemList[i] = itemList[i + 1];
}

}

Guess you like

Origin blog.csdn.net/zzxin1216/article/details/110518462