closure class groovy code example
Example 1: groovy3 closure
def listener = { e -> println "Clicked on $e.source" } (1)
assert listener instanceof Closure
Closure callback = { println 'Done!' } (2)
Closure<Boolean> isTextFile = {
File it -> it.name.endsWith('.txt') (3)
}
Example 2: groovy3 closure
{ [closureParameters -> ] statements }