我很迷住。下面的代碼給了我一個indexoutofbound錯誤。但是,如果我要刪除啓用for(j <- i until tmpArray.length)
的斜槓,它將起作用。我真的不明白爲什麼會發生,並希望得到解釋。ObservableBuffer給斯卡拉IndexOutOfBounds
for(i <- 0 until tmpArray.length)
{
// for(j <- i until tmpArray.length)
// {
if(date.getValue != null && tmpArray(i).date != date.getValue)
{
tmpArray.remove(i)
}
// }
}
你爲什麼不嘗試'ArrayBuffer'而不是'ObservableBuffer'? –