diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java b/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java index 07a2e0d55..778e66f5c 100644 --- a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java @@ -159,17 +159,17 @@ public class CollUtil { @SafeVarargs public static Set unionDistinct(Collection coll1, Collection coll2, Collection... otherColls) { final Set result; - if(isEmpty(coll1)){ + if (isEmpty(coll1)) { result = new LinkedHashSet<>(); } else { result = new LinkedHashSet<>(coll1); } - if(isNotEmpty(coll2)){ + if (isNotEmpty(coll2)) { result.addAll(coll2); } - if(ArrayUtil.isNotEmpty(otherColls)){ + if (ArrayUtil.isNotEmpty(otherColls)) { for (Collection otherColl : otherColls) { result.addAll(otherColl); } @@ -193,17 +193,17 @@ public class CollUtil { @SafeVarargs public static List unionAll(Collection coll1, Collection coll2, Collection... otherColls) { final List result; - if(isEmpty(coll1)){ + if (isEmpty(coll1)) { result = new ArrayList<>(); } else { result = new ArrayList<>(coll1); } - if(isNotEmpty(coll2)){ + if (isNotEmpty(coll2)) { result.addAll(coll2); } - if(ArrayUtil.isNotEmpty(otherColls)){ + if (ArrayUtil.isNotEmpty(otherColls)) { for (Collection otherColl : otherColls) { result.addAll(otherColl); } @@ -409,11 +409,11 @@ public class CollUtil { * @since 4.5.12 */ public static boolean containsAll(Collection coll1, Collection coll2) { - if(isEmpty(coll1)){ + if (isEmpty(coll1)) { return isEmpty(coll2); } - if(isEmpty(coll2)){ + if (isEmpty(coll2)) { return true; } @@ -1271,8 +1271,8 @@ public class CollUtil { * @param editor 编辑器 * @param ignoreNull 是否忽略空值 * @return 抽取后的新列表 - * @since 4.5.7 * @see #map(Iterable, Function, boolean) + * @since 4.5.7 */ public static List extract(Iterable collection, Editor editor, boolean ignoreNull) { return map(collection, editor::edit, ignoreNull); @@ -1282,6 +1282,8 @@ public class CollUtil { * 通过func自定义一个规则,此规则将原集合中的元素转换成新的元素,生成新的列表返回
* 例如提供的是一个Bean列表,通过Function接口实现获取某个字段值,返回这个字段值组成的新列表 * + * @param 集合元素类型 + * @param 返回集合元素类型 * @param collection 原集合 * @param func 编辑函数 * @param ignoreNull 是否忽略空值