Created
July 29, 2015 23:49
-
-
Save aruizca/9dfba8ee32b27aa2f50e to your computer and use it in GitHub Desktop.
Monad example from Mario Fusco's "Monadic Java" presentation but implemented in Groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String getCarInsuranceName(Person person) { | |
String insuranceName = person?.getCar()?.getInsurance()?.getName() | |
return insuranceName?:"Unknown" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Monadic Java preso link: http://www.slideshare.net/mariofusco/monadic-java/7
The Functional Java equivalent code is in slide 17