iterator
- noun
- /ˈɪtəˌreɪtər/
- Specialized
- Regarding generators and iterators, it is true that Go doesn't have them, but you can easily replace them with unbuffered channels and goroutines:
Examples
-
An iterator is essential for traversing data structures like arrays and lists in a systematic way.
-
The iterator allows programmers to access each element in the collection one by one.
-
So I can assign that over here by having iterator of strings.
-
And most importantly, some iterators can never return.
-
Now I'm going to use iterators in a more complicated way to do a join.
-
Each process simply pushes a new element at the end of the list and returns the iterator.
Blog text (5) -
Instead, you can use the sort algorithm on any container that implements the right kind of iterators ...
Blog text (32) -
Using an iterator, you can easily loop through a list of items in your program.
Synonyms
An object that gives items from a list one by one
Surface Forms
Morphology
Etymology
Iterator comes from the Latin root iterare 'to do again' and shares the same root as iterate and iteration, which helps you remember the idea of repeating. So in programming an iterator is a tool that repeats the same step for each item, letting you go through a list 'one by one'.