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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly