50,526
社区成员
发帖
与我相关
我的任务
分享
public static void delete(String next, ArrayList<String> al) {
for(Iterator<String> it=al.iterator();it.hasNext();){
String line=it.next();
int i=line.indexOf(next);
if(i>=0){
line=line.substring(0, i)+line.substring(i+next.length());
al.set(i, line);
System.out.println("删除成功");
break;
}else{
System.out.println("没有找到指定 的字符串");
}
}
}
private void rangeCheck(int index) {
if (index >= size)
throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}