groovy cheat list

2月 8, 2022 |

closure

//通过方法引用获取闭包
Closure smallerSix = six.&filter

this:enclosing class where the closure is defined
owner:enclosing class or enclosing closure where the closure is defined
delegate: default to owner

闭包的两种使用方式

curry从左向右固定参数,成为另一个闭包

range

*将将集合中元素插入到另一个集合

map

simple datatypes

Posted in: IT人生

Comments are closed.