ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 ``` /** * <b>方法描述:</b> 并集 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-11 11:52:30 <br/> * * @param c1 * 入参|集合1|{@link java.util.Collection} * @param c2 * 入参|集合2|{@link java.util.Collection} * @param c * 出参|并集|{@link java.util.Set} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "并集", style = "判断型", type = "同步组件", comment = "取两个集合的交并集", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-11 11:52:30") @InParams(param = { @Param(name = "c1", comment = "集合1", type = java.util.Collection.class), @Param(name = "c2", comment = "集合2", type = java.util.Collection.class) }) @OutParams(param = { @Param(name = "c", comment = "并集", type = java.util.Set.class) }) @Returns(returns = { @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_union(Collection c1, Collection c2) { if (c1 == null && c2 == null) return ResultBase.newFailureResult("TPTC1008", "两个集合为空集合(Null)"); if (c1 == null && c2 != null) return ResultBase.newSuccessResult(c2); if (c1 != null && c2 == null) return ResultBase.newSuccessResult(c1); Set set = new HashSet<Object>(); set.addAll(c1); set.addAll(c2); return ResultBase.newSuccessResult(set); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/70/df/70dfc6a5f80ab255cd33471f3c90b583_1863x888.png) # 参数说明及示例 ## 入口参数 集合1:传入一个集合,示例: `__REQ__["list1"]` 集合2:传入一个集合,示例: `__REQ__["list2"]` ## 出口参数 并集:获取两个集合的所有元素,不包含重复,示例: `__INNER__["set"]` > 注意:IDE 中集合和数组都以 [] 表示。