When declaring a closure, we can request it for the number of accepted parameters using:
Closure
So for example:
def closure = { String param -> } println(closure.maximumNumberOfParameters)
It will display:
1
Why does the method declare the number of parameters as a maximum, and not a constant?
In what situation will the return value of this method differ from the actual number of parameters declared in the close?
noamt source share