CollUtil.subtract增加空判定

This commit is contained in:
Looly
2024-06-04 08:47:39 +08:00
parent 2857c0af65
commit 9db9648539
2 changed files with 6 additions and 1 deletions

View File

@@ -361,6 +361,10 @@ public class CollUtil {
* @return 单差集
*/
public static <T> Collection<T> subtract(Collection<T> coll1, Collection<T> coll2) {
if(isEmpty(coll1) || isEmpty(coll2)){
return coll1;
}
Collection<T> result = ObjectUtil.clone(coll1);
try {
if (null == result) {