mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix code
This commit is contained in:
parent
b5dc741079
commit
d567efde00
@ -154,11 +154,17 @@ public class CollectionOperation<E> {
|
||||
*/
|
||||
public Set<E> intersectionDistinct() {
|
||||
final Collection<E>[] colls = this.colls;
|
||||
// 任意容器为空, 则返回空集
|
||||
if (ArrayUtil.isEmpty(colls)) {
|
||||
return SetUtil.zeroLinked();
|
||||
}
|
||||
|
||||
// 任意容器为空, 则返回空集
|
||||
for (Collection<E> coll : colls) {
|
||||
if(CollUtil.isEmpty(coll)){
|
||||
return SetUtil.zeroLinked();
|
||||
}
|
||||
}
|
||||
|
||||
final Set<E> result = SetUtil.of(true, colls[0]);
|
||||
for (int i = 1; i < colls.length; i++) {
|
||||
if(CollUtil.isNotEmpty(colls[i])){
|
||||
|
@ -177,6 +177,7 @@ public class CollUtilTest {
|
||||
Assert.assertEquals(SetUtil.ofLinked("a", "b", "c", "d"), intersectionDistinct);
|
||||
|
||||
final Collection<String> intersectionDistinct2 = CollUtil.intersectionDistinct(list1, list2, list3);
|
||||
Console.log(intersectionDistinct2);
|
||||
Assert.assertTrue(intersectionDistinct2.isEmpty());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user