提问人:eastwater 提问时间:10/11/2022 最后编辑:eastwater 更新时间:10/11/2022 访问量:65
Groovy:如何使用闭包变量而不是 NOT 将过滤器应用于集合?
Groovy: how to apply filters using closure variable and NOT to a collection?
问:
Groovy:如何使用定义的闭包将过滤器应用于集合?例如:
def f = { it -> it.name.contains("foo") }
aCollection.filter { it -> !it.name.contains("foo") }
如何将闭包变量应用于过滤方法?喜欢
aCollection.filter {! f } //NOT
答: 暂无答案
评论