加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

在groovy集合中相交的对面

发布时间:2020-12-14 16:35:38 所属栏目:大数据 来源:网络整理
导读:groovy系列中相交的是什么? 解决方法 你可能想要结合来自@Andre和@denis的答案 我想你想要的是联合,然后从此减去交叉点 def a = [1,2,3,4,5]def b = [2,4]assert [1,5] == ( a + b ) - a.intersect( b ) denis提供的解决方案取决于你是否做到这一点 def opp
groovy系列中相交的是什么?

解决方法

你可能想要结合来自@Andre和@denis的答案

我想你想要的是联合,然后从此减去交叉点

def a = [1,2,3,4,5]
def b = [2,4]

assert [1,5] == ( a + b ) - a.intersect( b )

denis提供的解决方案取决于你是否做到这一点

def opposite = leftCollection-rightCollection // [1,5]

要么

def opposite = rightCollection-leftCollection // []

我不认为你想要的

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读