我一直試圖從地圖中的鍵獲取特定值(這是一個列表)。我總是得到一個[null, null]
。我嘗試了一切,從我在網上找到的東西。groovy:從地圖中的鍵中獲取一個值(這是一個列表)
// returns null
def key = "name"
def map = [name:[hello, there]]
log.debug "map value ${map[key]}"
// returns hello
def key = "name"
def map = [name:"hello"]
log.debug "map value ${map[key]}"
我如何獲得上述返回值列表,即[hello, there]
?
'hello'和'there'可能被初始化爲null。這些變量在哪裏定義和初始化? –