企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 ``` /** * <b>方法描述:</b> 交集 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-11 11:52:25 <br/> * * @param c1 * 入参|集合1|{@link java.util.Collection} * @param c2 * 入参|集合2|{@link java.util.Collection} * @param c * 出参|交集|{@link java.util.Collection} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "交集", style = "判断型", type = "同步组件", comment = "取两个集合的交交集,不存在交集返回空集合", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-11 11:52:25") @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.Collection.class) }) @Returns(returns = { @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_retain(Collection c1, Collection c2) { if (c1 == null && c2 == null) return ResultBase.newFailureResult("TPTC1007", "两个集合为空集合(NULL)"); if (c1 == null && c2 != null) return ResultBase.newSuccessResult(c2); if (c1 != null && c2 == null) return ResultBase.newSuccessResult(c1); List list1 = new ArrayList<Object>(c1); List list2 = new ArrayList<Object>(c2); list1.retainAll(list2); return ResultBase.newSuccessResult(list1); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/34/b2/34b2a95f84644da54554d99763402a5b_1865x881.png) # 参数说明及示例 ## 入口参数 集合1:传入一个集合,示例: `[1,2,3,4,5]` 集合2:传入一个集合,示例: `[1,3,5,7,9]` ## 出口参数 交集:取两个集合的共有部分,示例: `__INNER__["list"]` > 注意:IDE 中集合和数组都以 [] 表示。