You never call i.next(). In addition, i- instanceof Iterator, therefore, i instanceof NoteItemnever will be true. You should read the data in i.next()and evaluate this item with your conditions.
This is how the code should be:
for(Iterator<Item> i = mItemList.iterator(); i.hasNext(); ) {
Item item = i.next();
if(item instanceof NoteItem && ((NoteItem) item).getIconSet() == iconSet) {
i.remove();
foundCount++;
}
}
source
share