java - Removing object from Iterator AFTER pressing a key -
im trying remove object arraylist, getting referred iterator, can remove object. thing is, doesn't work.
when key "in case, down" pressed while keyboard next running, has remove lastest object created in 'balls' arraylist.
i'm using lwjgl , opengl this.
while(keyboard.next()) { if(keyboard.iskeydown(keyboard.key_down)) { iterator<ball> theball = balls.iterator(); while (theball.hasnext()) { theball.remove(); } } }
remember have phone call theball.next();
in order go next item. don't see in code.
java opengl arraylist iterator lwjgl
No comments:
Post a Comment