I'm trying to loop through an ArrayList, Here my old code which gives error when trying to add new NPC
if (npcs != null && npcs.size() > 1) {
        for (NPC npc: npcs) {
            if (npc != null)
                if(npc.getShow())
                    npc.render(g);
        }
    }
So I tried turning that into a ListIterator to fix the issue,
private void render(Graphics g) {
listIter = npcs.listIterator();
        int index = 0;
            while(listIter.hasNext())
            {
                if(shouldAdd(index+1)) {
                    index++;
                    listIter.add(npcs.get(index));
                }
                NPC current = (NPC) listIter.next();
                if (current != null) {
                    if (current.getShow()) {
                        current.render(g);
                    }
                }
            }
}
    private boolean shouldAdd(int index) {
            if (npcs.size() > index) {
                return true;
            }
            return false;
        }
Could someone please help me out and show me what I'm doing wrong?
