I'm looking at the Best Practices section of "Beginning Android
Games", and it says:

"Don't use iterators, as they create new objects."

Can someone help me understand?

The reason I ask is because I'm seeing performance issues with this
method:

        public static void burnfire() {
                   for (final Iterator<Particle> i = particles.iterator();
i.hasNext();) {
                     final Particle p = i.next();
                     p.move();
                     p.timeleft--;

                     if (p.timeleft == 0) {
                       i.remove();
                     }
                   }

                }

The method just traverses a linked list and moves some particles.  Are
objects being created there?

How can I make that faster?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to