随笔分类 -  groovy高级

摘要:def printSomething(param){ println param } def printSomething(param01,param02){ println param01+" "+param02 } printSomething("hello") printSomething(" 阅读全文
posted @ 2022-02-15 15:09 该显示昵称已被使用了 阅读(153) 评论(0) 推荐(0)
摘要:为什么要使用闭包 # 参考 https://juejin.cn/post/6844903878111019022 # 闭包模板 def closure4 = { x, y -> println("x is ${x}, y is ${y}") } // 省略类型 Closure closure6 = 阅读全文
posted @ 2021-07-19 13:28 该显示昵称已被使用了 阅读(94) 评论(0) 推荐(0)
摘要:show = { println it } square_root = { Math.sqrt(it) } def please(action) { [the: { what -> [of: { n -> action(what(n)) }] }] } please show the square_ 阅读全文
posted @ 2021-07-19 13:16 该显示昵称已被使用了 阅读(31) 评论(0) 推荐(0)
摘要:def retry(int times = 5, Closure errorHandler = {e-> log.warn(e.message,e)} , Closure body) { int retries = 0 def exceptions = [] while(retries++ < ti 阅读全文
posted @ 2021-07-15 10:13 该显示昵称已被使用了 阅读(118) 评论(0) 推荐(0)