Commit e0548e7f authored by Milan Straka's avatar Milan Straka

Explicitly show how to iterate over the data in the comment.

parent 87bbc071
......@@ -5,8 +5,12 @@ vector<string> find_duplicates(DataGenerator& generator) {
* Find duplicates in the given data.
*
* The `generator` provides a forward iterator over strings
* for traversing the data (so it can be iterated for example
* using a `for` cycle). It can be traversed multiple times.
* for traversing the data, so it can be iterated for example
* using a `for` cycle:
*
* for (const string& item : generator) {...}
*
* The `generator` can be traversed multiple times.
*
* The goal is to return a vector of duplicated entries,
* reporting each duplicated entry only once, in the order
......
......@@ -4,9 +4,12 @@ import sys
def find_duplicates(data_generator):
"""Find duplicates in the given data.
The data_generator is an `iterable` (it can be iterated over in a for cycle,
or passed to `iter` method to explicitly generate an iterator) returning
strings. It can be iterated multiple times.
The `data_generator` is an iterable over strings, so it can be
iterated for example using a `for` cycle:
for item in data_generator: ...
It can be iterated multiple times.
The goal is to return a list of duplicated entries, reporting each duplicated
entry only once, in the order of their first occurrence in the data.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment