Top "Iteration" questions

Iterations are the successive repetitions in loops such as for, foreach or while.

Iterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loop

We all know you can't do the following because of ConcurrentModificationException: for (Object i : l) { if (condition(i)) { l.remove(…

java collections iteration
How do I loop through a list by twos?

I want to loop through a Python list and process 2 list items at a time. Something like this in another …

python list loops for-loop iteration
How to loop through an array containing objects and access their properties

I want to cycle through the objects contained in an array and change the properties of each one. If I …

javascript arrays iteration
How can I loop through a C++ map of maps?

How can I loop through a std::map in C++? My map is defined as: std::map< std::string, …

c++ loops dictionary iteration idioms
How does PHP 'foreach' actually work?

Let me prefix this by saying that I know what foreach is, does and how to use it. This question …

php loops foreach iteration php-internals
How do I iterate through children elements of a div using jQuery?

I have a div and it has several input elements in it... I'd like to iterate through each of those …

jquery iteration
How to loop backwards in python?

I'm talking about doing something like: for(i=n; i>=1; --i) { //do something with i } I can think of …

python iteration range
How do I iterate over an NSArray?

I'm looking for the standard idiom to iterate over an NSArray. My code needs to be suitable for OS X 10.4+.

objective-c cocoa iteration nsarray enumeration
How do I iterate through each element in an n-dimensional matrix in MATLAB?

I have a problem. I need to iterate through every element in an n-dimensional matrix in MATLAB. The problem is, …

arrays matlab matrix multidimensional-array iteration