From feba8fcb42d48ec080463b82671aa8b3fa7d947b Mon Sep 17 00:00:00 2001 From: Looly Date: Tue, 4 Jun 2024 08:47:34 +0800 Subject: [PATCH] =?UTF-8?q?CollUtil.subtract=E5=A2=9E=E5=8A=A0=E7=A9=BA?= =?UTF-8?q?=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/dromara/hutool/core/collection/CollUtil.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hutool-core/src/main/java/org/dromara/hutool/core/collection/CollUtil.java b/hutool-core/src/main/java/org/dromara/hutool/core/collection/CollUtil.java index d2fbb372c..e21fe7afc 100644 --- a/hutool-core/src/main/java/org/dromara/hutool/core/collection/CollUtil.java +++ b/hutool-core/src/main/java/org/dromara/hutool/core/collection/CollUtil.java @@ -397,6 +397,10 @@ public class CollUtil { * @return 单差集 */ public static Collection subtract(final Collection coll1, final Collection coll2) { + if(isEmpty(coll1) || isEmpty(coll2)){ + return coll1; + } + Collection result = ObjUtil.clone(coll1); if (null == result) { result = CollUtil.create(coll1.getClass());