/*
println("hello groovy");
def i = 8;
println i
def s = "ssss"
println s
def list = ['a', 'b']
list << 'c'
println list.get(2)
def map = ["key1": "value1", "key2": "value2"]
map.key3 = "value3"
println map.get("key3")
println "演示闭包: "
def b1 = {
println "hello b1"
}
def method1(Closure closure) {
closure();
}
method1(b1)
def b2 = {
v ->
println "hello ${v}"
}
def method2(Closure closure) {
closure("lee")
}
method2(b2)
def b3 = { it + 10}
println b3(2)*/
//List l = [1,2,3,4,5]
//
//println "result22 : " + l.findAll({it % 2 == 1})
def test(int i, Closure c) {
return c(i)
}
println test(3, {it * 2})
网友评论