这在Groovy中是什么类型的语法?

nkt*_*tsg 1 groovy

(postUrl, config, isLoggedIn) = getSpringSecurityLoginConfig()
Run Code Online (Sandbox Code Playgroud)

我在官方文档中找不到这种语法是什么?

tim*_*tes 5

这是多项任务.

这里有一篇博客文章文档:

Groovy支持多重赋值,即可以同时分配多个变量,例如:

def (a, b, c) = [10, 20, 'foo']
assert a == 10 && b == 20 && c == 'foo'
Run Code Online (Sandbox Code Playgroud)

如果您愿意,可以提供类型作为声明的一部分:

def (int i, String j) = [10, 'foo']
assert i == 10 && j == 'foo'
Run Code Online (Sandbox Code Playgroud)

除了在声明变量时使用它也适用于现有变量:

def nums = [1, 3, 5]
def a, b, c
(a, b, c) = nums
assert a == 1 && b == 3 && c == 5
Run Code Online (Sandbox Code Playgroud)

该语法适用于数组和列表,以及返回以下任一方法的方法:

def (_, month, year) = "18th June 2009".split()
assert "In $month of $year" == 'In June of 2009'
Run Code Online (Sandbox Code Playgroud)