Created
May 17, 2016 21:05
-
-
Save andrewglind/c1db20f4f2640cc2487292afc1bcfef3 to your computer and use it in GitHub Desktop.
Use a proxy to create an anonymous method pointer
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
def x = ["y":{z-> println "Hello, ${z ?: 'World'}!"}].&y | |
x() // Hello, World! | |
x('Blah') // Hello, Blah! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment