1 获取List集合中的元素
def lst = [1,3,4,1,8,9,2,6] println lst[-1] println lst[-2] 输出结果: 输出: 6 2
def lst = [1,6] //从左至右取值println lst[2..5] 输出结果:[4,9]//从右至左取值def lst = [1,6]println lst[-1..-4] 输出结果:[6, 2, 9, 8]
def lst = [1,6] //从左至右取值