Comment
Comment by heydenberk
Something that people may not see immediately is that flatMap is more general than map and filter. Say, for a contrived example, that you'd like to filter out the even numbers in an array, and then double the odd numbers that remain. Instead of:
You can do:
Again, this is a contrived example, but I think it's interesting since the generality is not obvious (to me)