Difference between map and flatMap in java 8

map() and flatMap()

map() -
It processes stream of values.
It’s mapper function produces single value for each input value.
It is provide One-To-One mapping b/w input and output

flatMap()
It processes stream of stream of values.
It’s mapper function produces multiple values for each input value.
It is provide One-To-Many mapping b/w input and output