马哥直播班Python运维自动化与DevOps项目特训班
private void resize(int newCapacity) {
// 1. 扩成多大
// 2. 原来元素怎么办
Object[] newElement = new Object[newCapacity];
for (int i = 0; i < size; i++) {
newElement[i] = elements[i];
}
this.elements = newElement;
this.capacity = newCapacity;
}}