The second parameter is a function closure.
第二个参数是一个函数闭包。
It defines a closure called recurse that can be called with only one parameter rather than two.
它定义了一个名为recurse的闭包,能够只使用一个参数来调用它,而不是两个。
Because it is a Seq, it has a foreach method that takes a closure as a parameter.
因为它是一个Seq,它具有一个foreach方法,并将一个闭包作为参数。
Note that where the final parameter to a method is a closure, Groovy permits that you can remove it from the list of actual parameters and place it immediately after the closing parenthesis.
注意方法的最后一个参数是个闭包,在这个地方Groovy允许把它从实际参数列表中删除,并把它直接放在结束括号后面。
The map closure has a parameter f that represents a closure and a parameter list that represents, not surprisingly, a List.
map闭包有一个参数f代表闭包,还有一个参数list 代表(不要惊讶)List。
The List referenced as ages is sent the collect() method with the single closure { element -> return element + 1 } as a parameter.
名为ages的List被发送给collect()方法,使用单个闭包 {element->return element +1 }作为参数。
In classic Groovy, if you declared a parameter to your closure you had to use a | character for a separator.
在经典的Groovy中,如果为闭包声明参数,就必须用|字符作为分隔符。
In classic Groovy, if you declared a parameter to your closure you had to use a | character for a separator.
在经典的Groovy中,如果为闭包声明参数,就必须用|字符作为分隔符。
应用推荐