enhance CollUtil

This commit is contained in:
Looly 2020-09-23 14:39:59 +08:00
parent c7a8aed325
commit 34443c3413
2 changed files with 6 additions and 5 deletions

View File

@ -15,6 +15,7 @@
* 【crypto 】 RC4增加ecryptpr#1108@Github
* 【core 】 CharUtil and StrUtil增加@pr#1106@Github
* 【extra 】 优化EMOJ查询逻辑pr#1112@Github
* 【extra 】 优化CollUtil交并集结果集合设置初始化大小避免扩容成本pr#1110@Github
### Bug修复
* 【crypto 】 修复SM2验签后无法解密问题issue#I1W0VP@Gitee

View File

@ -105,9 +105,9 @@ public class CollUtil {
*/
public static <T> Collection<T> union(Collection<T> coll1, Collection<T> coll2) {
if (isEmpty(coll1)) {
return new ArrayList<>(coll2);
return new ArrayList<>(coll2);
} else if (isEmpty(coll2)) {
return new ArrayList<>(coll1);
return new ArrayList<>(coll1);
}
final ArrayList<T> list = new ArrayList<>(Math.max(coll1.size(), coll2.size()));
@ -2848,10 +2848,10 @@ public class CollUtil {
/**
* 使用给定的转换函数转换源集合为新类型的集合
*
* @param <F> 源元素类型
* @param <T> 目标元素类型
* @param <F> 源元素类型
* @param <T> 目标元素类型
* @param collection 集合
* @param function 转换函数
* @param function 转换函数
* @return 新类型的集合
* @since 5.4.3
*/