mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-30 20:57:59 +08:00
CollUtil.subtract增加空判定
This commit is contained in:
parent
6b4c3b1e4d
commit
feba8fcb42
@ -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());
|
||||||
|
Loading…
Reference in New Issue
Block a user