Skip to content

Instantly share code, notes, and snippets.

@aruizca
Created July 29, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aruizca/9dfba8ee32b27aa2f50e to your computer and use it in GitHub Desktop.
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
String getCarInsuranceName(Person person) {
String insuranceName = person?.getCar()?.getInsurance()?.getName()
return insuranceName?:"Unknown"
}
@aruizca
Copy link
Author

aruizca commented Jul 29, 2015

Monadic Java preso link: http://www.slideshare.net/mariofusco/monadic-java/7

The Functional Java equivalent code is in slide 17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment