Iterator Trait Flashcards
1
Q
What is the diference between .flat_map() and .map()
A
- .flat_map() an iterator that works like map, but flattens nested structure.
- .map()’s closure returns one item for each element, and flat_map()’s closure returns an iterator for each element.