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.

Iterate through unordered map C++

I have wrote program which reads input until you hit ',' - COMA at the input. Then it counts …

c++ iterator unordered-map
Implementing an iterator over a binary search tree

I've been coding up a bunch of different binary search tree implementations recently (AVL, splay, treap) and am curious if …

algorithm iterator binary-search-tree
Using iterator on a TreeSet

SITUATION: I have a TreeSet of custom Objects and I have also used a custom Comparator. I have created an …

java collections iterator concurrentmodification treeset
What's the 'Ruby way' to iterate over two arrays at once

More of a syntax curiosity than a problem to solve... I have two arrays of equal length, and want to …

ruby arrays iterator
Cleanest way to get last item from Python iterator

What's the best way of getting the last item from an iterator in Python 2.6? For example, say my_iter = iter(…

python python-3.x python-2.7 iterator
Confused with python lists: are they or are they not iterators?

I am studying Alex Marteli's Python in a Nutshell and the book suggests that any object that has a next() …

python list iterator
What is an iterator's default value?

For any STL container that I'm using, if I declare an iterator (of this particular container type) using the iterator's …

c++ stl default containers iterator
Last key in a std::map

I am looking for the highest key value (a defined by the comparison operator) of a std::map. Is this …

c++ iterator stdmap
Generator functions equivalent in Java

I would like to implement an Iterator in Java that behaves somewhat like the following generator function in Python: def …

java python iterator generator
What is the reason behind cbegin/cend?

I wonder why cbegin and cend were introduced in C++11? What are cases when calling these methods makes a difference …

c++ c++11 iterator const-correctness const-iterator