Skip to main content
iterator

iterator

1 6.3
A tool in programming that goes through items in a list one by one
  • noun
  • /ˈɪtəˌreɪtər/
  • Specialized
translation icon : iterador
  • 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

iter
vsiterator
  • Specialized
9.2

An object that gives items from a list one by one

has the same meaning but frames it as a tool for stepping through items

Surface Forms

iterator singular
iterators plural

Morphology

iterator = iterate (transparent) = iterate + or

Built from 'iterate' + '-or'; the programming sense is a technical specialization but follows the same agent/instrument logic (something that 'iterates' over elements).

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'.