Skip to content

Instantly share code, notes, and snippets.

@nobeans
Created January 29, 2015 08:24
Show Gist options
  • Save nobeans/fa4f910f31109429b65f to your computer and use it in GitHub Desktop.
Save nobeans/fa4f910f31109429b65f to your computer and use it in GitHub Desktop.
クロージャの引数の数はどうなってるのか
def cd = { println("cd") }
def c0 = { -> println("c0") }
def c1 = { a -> println("c1:$a") }
def c2 = { a, b -> println("c2:$a:$b") }
assert cd.parameterTypes.size() == 1
assert c0.parameterTypes.size() == 0
assert c1.parameterTypes.size() == 1
assert c2.parameterTypes.size() == 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment