Не могу понять, почему это происходит бесконечно.Java Iterator Бесконечная петля
public void DLCCheck(IconSet iconSet) {
Log.d(TAG, "Got dlc check. Looking to see if we need to remove any notes from the current list.");
int foundCount = 0;
for(Iterator<Item> i = mItemList.iterator(); i.hasNext();) {
if(i instanceof NoteItem && ((NoteItem) i).getIconSet() == iconSet) {
i.remove();
foundCount++;
}
}
Log.d(TAG, "Finished searching. Found " + foundCount + "notes in the current list to delete.");
//notifyDataSetChanged();
//EventBus.getDefault().post(new MoveNoteListOut());
}
Не следует ли останавливать итерацию, когда hasNext возвращает false? В этом списке всего 6 наименований, но навсегда.
Это было на самом деле полезно. Почему это не по теме? – dan