Monads for Java developers: Part 1 — The Optional monad
Castaño
353

Good write. The nested flatmap thing could lead to a chaos in just a second. Maybe the Java people add something like for-comp or do notation like in Scala or Haskell to give more clarity on the monadic composition.

I got a little confused by

“… the flatMap method let us take the parameter from the monad and operate with it to produce another Monad …”

until I got it’s another Optional Monad what you’re talking about and not a different Monad.

Glad to see people like you writing about how to make safer code using Java and to see that functional concepts like this one get some traction in the industry.

Another read I find really useful is http://www.nurkiewicz.com/2016/06/functor-and-monad-examples-in-plain-java.html for you guys out there trying to check out more content on the same issue.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.