實際上,我想要設置arraylist的指針來索引我要提供的內容,然後我的程序會檢查是否還有元素,然後它會從我提供的那個索引中刪除所有元素。從arraylist中刪除元素
public void removefromindex(int index)
{
for (int j = notes.size(); j >notes.size(); j++)
{
notes.remove(j);
}
}
public void deleteAll(){
for (Iterator<Note> it = notes.iterator(); it.hasNext();)
{
Note note = it.next();
it.remove();
}
}
'爲(INT J = notes.size(); J>時notes.size() ; j ++)'< - 再次閱讀,這是沒有道理的。 – Tunaki