Groovy 是否有像 Javascript 这样的对象解构?
Does Groovy have object destructuring like Javascript?
Groovy 是否有对象解构和多个赋值,如 Javascript:
let options = {
title: "Menu",
width: 100,
height: 200
};
let {title, width, height} = options;
alert(title); // Menu
alert(width); // 100
alert(height); // 200
Groovy 没有 JavaScript 的对象解构...它只有基于索引的解构
https://groovy-lang.org/semantics.html#_object_destructuring_with_multiple_assignment
Groovy 是否有对象解构和多个赋值,如 Javascript:
let options = {
title: "Menu",
width: 100,
height: 200
};
let {title, width, height} = options;
alert(title); // Menu
alert(width); // 100
alert(height); // 200
Groovy 没有 JavaScript 的对象解构...它只有基于索引的解构
https://groovy-lang.org/semantics.html#_object_destructuring_with_multiple_assignment