Many of us Java developers — particularly beginners — often overlook its functional programming capabilities. In this article, we'd look at how to chain Optional
and Either
to write concise and beautiful code.
To illustrate, let's assume we have a bank where a user could have zero or more accounts. The entities look as below: