Java Stream – Map and FlatMap

Here is an example from book, it converts list of string into list of chars without duplicated. it is good example to show what different between map and flatmap. basically map will keep original structure of input element while flatmap won’t keep structure of input element.