On Tue, Oct 23, 2012 at 5:22 PM, clay <[email protected]> wrote: > Why is there no flatMap?
Would you really be satisfied if Optional had flatMap, though? Think about it carefully. To me, the main benefit of flatMap is composability. With flatMap, I can pass my Optional and other monadic values across a flow of transformations without ever having to drop down to raw values. And here is the rub: Optional would be the only type in the JDK that has this property. It would be a bit like being the only person on the planet with a fax machine. If all that I can do is composing Optionals with other Optionals, the value is severely limited. Once/if Optional gains flatMap, won't you want List to get it as well? And Map? And TreeSets? You see where this is going... -- Cédric -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
