N
nooneinparticular314159
I have an arraylist of objects of a certain type. I use an iterator
on that arraylist to get the next instance of the object, using the
iterator.next() method. But if I succeed in performing an operation
on the object, I want to remove the object from my arraylist. The
question is how I remove it without calling .next() again, since that
will remove the next one, not the current one? ie. If I am currently
working on the object at position 4 in the arraylist (through the
iterator), I want to remove the object at position 4. But I don't
know what position the object is in because I got it through the
iterator.
Thanks!
on that arraylist to get the next instance of the object, using the
iterator.next() method. But if I succeed in performing an operation
on the object, I want to remove the object from my arraylist. The
question is how I remove it without calling .next() again, since that
will remove the next one, not the current one? ie. If I am currently
working on the object at position 4 in the arraylist (through the
iterator), I want to remove the object at position 4. But I don't
know what position the object is in because I got it through the
iterator.
Thanks!