我定义了以下映射
def e_environments = [["[email protected]":"file1"], ["[email protected]":"file1"], ["[email protected]":"file2"], ["[email protected]":"file2"]]
有没有办法从一个变量值中替换出相同文件名的URL。例如
def demo_env = ["[email protected]","[email protected]"]
def insurance_env= ["[email protected]","[email protected]"]
def def e_environments = [[${demo_env}:"file1"], [${insurance_env}:"file2"]]
我希望你在这里问之前,一定要从你的方面做一些努力。这里有你要努力的地方。
def e_environments = [ "[email protected]":"file1", "[email protected]":"file1" , "[email protected]":"file2" ,"[email protected]":"file2" ]
def temp = []
e_environments.keySet().each{
temp.add(e_environments[it])
}
temp.unique().each{ val ->
println e_environments.findAll{it.value==val}
}