mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
CollUtil.subtract增加空判定
This commit is contained in:
@@ -397,6 +397,10 @@ public class CollUtil {
|
|||||||
* @return 单差集
|
* @return 单差集
|
||||||
*/
|
*/
|
||||||
public static <T> Collection<T> subtract(final Collection<T> coll1, final Collection<T> coll2) {
|
public static <T> Collection<T> subtract(final Collection<T> coll1, final Collection<T> coll2) {
|
||||||
|
if(isEmpty(coll1) || isEmpty(coll2)){
|
||||||
|
return coll1;
|
||||||
|
}
|
||||||
|
|
||||||
Collection<T> result = ObjUtil.clone(coll1);
|
Collection<T> result = ObjUtil.clone(coll1);
|
||||||
if (null == result) {
|
if (null == result) {
|
||||||
result = CollUtil.create(coll1.getClass());
|
result = CollUtil.create(coll1.getClass());
|
||||||
|
Reference in New Issue
Block a user