9

Does Groovy have object destructuring with multiple assignments like Javascript:

let options = {
  title: "Menu",
  width: 100,
  height: 200
};

let {title, width, height} = options;

alert(title);  // Menu
alert(width);  // 100
alert(height); // 200
dilvan
  • 2,109
  • 2
  • 20
  • 32

1 Answers1

7

Groovy doesn't have JavaScript's object destructuring... It only has index based destructuring

https://groovy-lang.org/semantics.html#_object_destructuring_with_multiple_assignment

tim_yates
  • 167,322
  • 27
  • 342
  • 338