code review:工作流的加减签

This commit is contained in:
YunaiV
2023-10-21 21:04:20 +08:00
parent cc67174f87
commit 3bb3e4caf6
5 changed files with 25 additions and 26 deletions

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.framework.common.util.collection;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
import com.google.common.collect.ImmutableMap;
import java.util.*;
@ -269,7 +268,7 @@ public class CollectionUtils {
return deptId == null ? Collections.emptyList() : Collections.singleton(deptId);
}
public static <T, U> List<U> convertListByMultiAttr(Collection<T> from,
public static <T, U> List<U> convertListByFlatMap(Collection<T> from,
Function<T, ? extends Stream<? extends U>> func) {
if (CollUtil.isEmpty(from)) {
return new ArrayList<>();
@ -277,11 +276,12 @@ public class CollectionUtils {
return from.stream().flatMap(func).filter(Objects::nonNull).collect(Collectors.toList());
}
public static <T, U> Set<U> convertSetByMultiAttr(Collection<T> from,
Function<T, ? extends Stream<? extends U>> func) {
public static <T, U> Set<U> convertSetByFlatMap(Collection<T> from,
Function<T, ? extends Stream<? extends U>> func) {
if (CollUtil.isEmpty(from)) {
return new HashSet<>();
}
return from.stream().flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet());
}
}