Groovy Duke
02/08/2024, 6:29 PMString someMethod(String message, Closure transform){
return transform(message)
}
you could call that like:
someMethod('test' {String s -> s.toUpperCase})
or
someMethod('test') {String s -> s.toUpperCase}
The second option is usually a little easier to read. in your case createCriteria takes a closure as its parameter and then on the result of that call you want to call list, which is another method to actually make the call to the db and it takes its own parameters, which are essential a map which could be written like:
list([max: 1, sort: "instTermCode", order: "desc"])
but in this case, the extra [] are just noise, and groovy allows you to drop them. Hope this explanation helps a little.