class GroovyTest {
static void main(args) {
def list = [1,2,3]
def newList = list.multiply(2)
println(newList)
def list1 = [1,2,3]
def newList1 = list*3
println(newList1)
}
}
输出:
[1, 2, 3, 1, 2, 3]
[1, 2, 3, 1, 2, 3, 1, 2, 3]
image.png
网友评论