Why Optional<> is a Monad and Why the f() Should I Care?

Please, Use Optional<> In the Intended Way!

Emanuel Trandafir
Level Up Coding
Published in
5 min readOct 23, 2022

--

Please, Use Optional<> In the Intended Way! — Photo by Zachary Kadolph on Unsplash

1. Overview

Firstly, let’s see where the need for Optional (and for monads, in general) comes from. To do this, we’ll start with an analogy and think of the process of making bread.

  • firstly, we’ll make flour by milling the wheat;

--

--

Hi, I'm Emanuel Trandafir, a Java developer from Romania. I have a strong passion for clean code, software design, and unit testing.