Top "Iterator" questions

An iterator is an object-oriented programming pattern that allows traversal through a collection, agnostic of the actual implementation or object addresses in physical memory.

Best way to loop over a python string backwards

What is the best way to loop over a python string backwards? The following seems a little awkward for all …

python string optimization iterator reverse
What are fail-safe & fail-fast Iterators in Java

There are two types of iterators in Java: fail-safe and fail-fast. What does this mean, and is the difference between …

java iterator terminology
What's the best way to iterate over two or more containers simultaneously

C++11 provides multiple ways to iterate over containers. For example: Range-based loop for(auto c : container) fun(c) std::for_…

c++ c++11 iterator containers
c++ uint , unsigned int , int

Hi I have a program that deals alot with vectors and indexes of the elements of these vectors, and I …

c++ indexing int iterator unsigned
Why are Objects not Iterable in JavaScript?

Why are objects not iterable by default? I see questions all the time related to iterating objects, the common solution …

javascript arrays iterator ecmascript-6 ecmascript-5
How can I delete elements of a std::map with an iterator?

I would like to loop through an std::map and delete items based on their contents. How best would this …

c++ map iterator stdmap
How to do multiple imports in Python?

In Ruby, instead of repeating the "require" (the "import" in Python) word lots of times, I do %w{lib1 lib2 …

python import iterator require
How to erase & delete pointers to objects stored in a vector?

I have a vector that stores pointers to many objects instantiated dynamically, and I'm trying to iterate through the vector …

c++ visual-c++ vector iterator erase
Very simple prime number test - I think I'm not understanding the for loop

I am practicing past exam papers for a basic java exam, and I am finding it difficult to make a …

java loops for-loop iterator primes
Checking if an iterator is valid

Is there any way to check if an iterator (whether it is from a vector, a list, a deque...) is (…

c++ stl iterator dereference