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.

Reading .csv in Python without looping through the whole file?

The only way I've seen Python's csv.reader used is in a for loop, which goes through the whole file …

python csv iterator next
What's wrong with passing C++ iterator by reference?

I've written a few functions with a prototype like this: template <typename input_iterator> int parse_integer(input_…

c++ pass-by-reference iterator
Pass multiple parameters to concurrent.futures.Executor.map?

The concurrent.futures.Executor.map takes a variable number of iterables from which the function given is called. How should …

python concurrency iterator future map-function
Can I check a C++ iterator against null?

I'm having trouble with vector iterators. I've read in a few places that checking for null iterators isn't possible, and …

c++ pointers vector iterator nullptr
Iterate over all pairs of consecutive items in a list

Given a list l = [1, 7, 3, 5] I want to iterate over all pairs of consecutive list items (1,7), (7,3), (3,5), i.e. for i in …

python list iterator
Implement Java Iterator and Iterable in same class?

I am trying to understand Java Iterator and Iterable interfaces I am writing this class class MyClass implements Iterable<…

java iterator iterable
How does RecursiveIteratorIterator work in PHP?

How does RecursiveIteratorIterator work? The PHP manual has nothing much documented or explained. What is the difference between IteratorIterator and …

php iterator spl
Asynchronous iterator Task<IEnumerable<T>>

I’m trying to implement an asynchronous function that returns an iterator. The idea is the following: private async Task&…

c# .net asynchronous iterator clr
How to use an iterator?

I'm trying to calculate the distance between two points. The two points I stored in a vector in C++: (0,0) and (1,1). …

c++ pointers vector iterator using-statement
Tuple Unpacking in Map Operations

I frequently find myself working with Lists, Seqs, and Iterators of Tuples and would like to do something like the …

scala map iterator tuples iterable-unpacking