So one thing to know about groovy is that when a m...
# questions
g
So one thing to know about groovy is that when a method takes a closure as a parameter and it is the last parameter you can use an alternate syntax. So if you have a method like:
Copy code
String someMethod(String message, Closure transform){
    return transform(message)
}
you could call that like:
Copy code
someMethod('test' {String s -> s.toUpperCase})
or
Copy code
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:
Copy code
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.
💚 1