Commit 94b724e30aef40cb2e24399d6fb204f91cac3332
Merge remote-tracking branch 'origin/develop' into develop
Showing
1 changed file
with
5 additions
and
5 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java
| ... | ... | @@ -78,7 +78,7 @@ public class CollectionUtils { |
| 78 | 78 | if (CollUtil.isEmpty(from)) { |
| 79 | 79 | return new ArrayList<>(); |
| 80 | 80 | } |
| 81 | - return from.stream().flatMap(func).filter(Objects::nonNull).collect(Collectors.toList()); | |
| 81 | + return from.stream().filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toList()); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | public static <T, U, R> List<R> convertListByFlatMap(Collection<T> from, |
| ... | ... | @@ -87,7 +87,7 @@ public class CollectionUtils { |
| 87 | 87 | if (CollUtil.isEmpty(from)) { |
| 88 | 88 | return new ArrayList<>(); |
| 89 | 89 | } |
| 90 | - return from.stream().map(mapper).flatMap(func).filter(Objects::nonNull).collect(Collectors.toList()); | |
| 90 | + return from.stream().map(mapper).filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toList()); | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public static <K, V> List<V> mergeValuesFromMap(Map<K, List<V>> map) { |
| ... | ... | @@ -123,7 +123,7 @@ public class CollectionUtils { |
| 123 | 123 | if (CollUtil.isEmpty(from)) { |
| 124 | 124 | return new HashSet<>(); |
| 125 | 125 | } |
| 126 | - return from.stream().flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 126 | + return from.stream().filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public static <T, U, R> Set<R> convertSetByFlatMap(Collection<T> from, |
| ... | ... | @@ -132,7 +132,7 @@ public class CollectionUtils { |
| 132 | 132 | if (CollUtil.isEmpty(from)) { |
| 133 | 133 | return new HashSet<>(); |
| 134 | 134 | } |
| 135 | - return from.stream().map(mapper).flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 135 | + return from.stream().map(mapper).filter(Objects::nonNull).flatMap(func).filter(Objects::nonNull).collect(Collectors.toSet()); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | public static <T, K> Map<K, T> convertMap(Collection<T> from, Function<T, K> keyFunc) { |
| ... | ... | @@ -315,4 +315,4 @@ public class CollectionUtils { |
| 315 | 315 | return list.stream().flatMap(Collection::stream).collect(Collectors.toList()); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | -} |
| 319 | +} | |
| 319 | 320 | \ No newline at end of file | ... | ... |