代码拉取完成,页面将自动刷新
package LBT2;
public class ArrayListUnordered<T> extends ArrayList<T> {
public void addToFront(T element) {
if (size() == list.length)
expandCapacity();
for (int i = rear; i > 0; i--)
list[i] = list[i - 1];
list[0] = element;
rear++;
modCount++;
}
public void addToRear(T element) {
if (size() == list.length)
expandCapacity();
list[rear] = element;
rear++;
modCount++;
}
public void addAfter(T element, T target) {
if (size() == list.length)
expandCapacity();
int scan = 0;
while (scan < rear && !target.equals(list[scan]))
scan++;
if (scan == rear)
try {
throw new ElementNotFoundException("UnorderedList");
} catch (ElementNotFoundException e) {
e.printStackTrace();
}
scan++;
for (int shilt = rear; shilt > scan; shilt--)
list[shilt] = list[shilt - 1];
list[scan] = element;
rear++;
modCount++;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。