Kotlin like scope functions (let, also, apply, run) in Groovy

Viewed 223

I think the title speaks for itself - does Groovy have something like Kotlin scope functions?

obj.apply {
  foo()
  bar()
  baz()
}

// is the same as
obj.foo()
obj.bar()
obj.baz()
1 Answers
Related