企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 ``` /** * <b>方法描述:</b> 差集 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-11 11:52:36 <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:36") @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_difference(Collection c1, Collection c2) { if (c1 == null && c2 == null) return ResultBase.newFailureResult("TPTC1009", "两个集合为空集合(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.removeAll(list2); return ResultBase.newSuccessResult(list1); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/0c/dc/0cdcb46678872d470ee0c2ebaae2440a_1868x886.png) # 参数说明及示例 ## 入口参数 集合1:传入一个集合,示例: `[1,2,3]` 集合2:传入一个集合,示例: `[2,3,4]` ## 出口参数 差集:取第一个集合独有的元素,示例: `__INNER__["list"]` > 注意:IDE 中集合和数组都以 [] 表示。