mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-24 18:04:54 +08:00
fix
This commit is contained in:
parent
37c2c07164
commit
7a1438fc02
@ -278,6 +278,7 @@ public class CollUtil {
|
||||
* @param coll2 集合2
|
||||
* @param otherColls 其它集合
|
||||
* @return 并集的集合,返回 {@link LinkedHashSet}
|
||||
* @since 5.3.9
|
||||
*/
|
||||
@SafeVarargs
|
||||
public static <T> Set<T> intersectionDistinct(Collection<T> coll1, Collection<T> coll2, Collection<T>... otherColls) {
|
||||
@ -294,7 +295,9 @@ public class CollUtil {
|
||||
|
||||
if (ArrayUtil.isNotEmpty(otherColls)) {
|
||||
for (Collection<T> otherColl : otherColls) {
|
||||
result.retainAll(otherColl);
|
||||
if(isNotEmpty(otherColl)){
|
||||
result.retainAll(otherColl);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -81,7 +81,7 @@ public class CollUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void intersectionTest2() {
|
||||
public void intersectionDistinctTest() {
|
||||
ArrayList<String> list1 = CollUtil.newArrayList("a", "b", "b", "c", "d", "x");
|
||||
ArrayList<String> list2 = CollUtil.newArrayList("a", "b", "b", "b", "c", "d");
|
||||
ArrayList<String> list3 = CollUtil.newArrayList();
|
||||
|
Loading…
Reference in New Issue
Block a user