I am using OpenGl in android and they have a callback method called draw that gets called with out my control. (As fast as the device can handle if I am not mistaken) I have a list of “GameObjects” that have a .draw method and a .update method. I have two different threads that handle each of those. So, the question is, can I declare two different iterators in two different methods in two different threads that iterate over the same Linked List? If so, do I simply declare ListIterator<GameObject> l = objets.listIterator() each time I want a new iterator and it won’t interfere with other iterators?
I am using OpenGl in android and they have a callback method called draw
Share
Yes, you can have multiple iterators for the same list. They do not interfere with each-other.
What you cannot do is modify the list while the iterators are still active (I mean, you can, but this will break the iterators, they will fail with an exception).