mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-23 23:09:47 +08:00
Compare commits
3 Commits
26ce8f30c9
...
3a11f18656
Author | SHA1 | Date | |
---|---|---|---|
3a11f18656 | |||
5a43212ccc | |||
f4cfd1c913 |
@ -1,6 +1,7 @@
|
|||||||
package org.dromara.common.core.utils;
|
package org.dromara.common.core.utils;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E> List<E> filter(Collection<E> collection, Predicate<E> function) {
|
public static <E> List<E> filter(Collection<E> collection, Predicate<E> function) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(function)
|
.filter(function)
|
||||||
@ -127,7 +128,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E> List<E> sorted(Collection<E> collection, Comparator<E> comparing) {
|
public static <E> List<E> sorted(Collection<E> collection, Comparator<E> comparing) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@ -148,7 +149,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <V, K> Map<K, V> toIdentityMap(Collection<V> collection, Function<V, K> key) {
|
public static <V, K> Map<K, V> toIdentityMap(Collection<V> collection, Function<V, K> key) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyMap();
|
return MapUtil.newHashMap();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@ -169,7 +170,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E, K, V> Map<K, V> toMap(Collection<E> collection, Function<E, K> key, Function<E, V> value) {
|
public static <E, K, V> Map<K, V> toMap(Collection<E> collection, Function<E, K> key, Function<E, V> value) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyMap();
|
return MapUtil.newHashMap();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@ -187,7 +188,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <K, E, V> Map<K, V> toMap(Map<K, E> map, BiFunction<K, E, V> take) {
|
public static <K, E, V> Map<K, V> toMap(Map<K, E> map, BiFunction<K, E, V> take) {
|
||||||
if (CollUtil.isEmpty(map)) {
|
if (CollUtil.isEmpty(map)) {
|
||||||
return Collections.emptyMap();
|
return MapUtil.newHashMap();
|
||||||
}
|
}
|
||||||
return toMap(map.entrySet(), Map.Entry::getKey, entry -> take.apply(entry.getKey(), entry.getValue()));
|
return toMap(map.entrySet(), Map.Entry::getKey, entry -> take.apply(entry.getKey(), entry.getValue()));
|
||||||
}
|
}
|
||||||
@ -204,7 +205,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E, K> Map<K, List<E>> groupByKey(Collection<E> collection, Function<E, K> key) {
|
public static <E, K> Map<K, List<E>> groupByKey(Collection<E> collection, Function<E, K> key) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyMap();
|
return MapUtil.newHashMap();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@ -225,7 +226,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E, K, U> Map<K, Map<U, List<E>>> groupBy2Key(Collection<E> collection, Function<E, K> key1, Function<E, U> key2) {
|
public static <E, K, U> Map<K, Map<U, List<E>>> groupBy2Key(Collection<E> collection, Function<E, K> key1, Function<E, U> key2) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyMap();
|
return MapUtil.newHashMap();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@ -246,7 +247,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E, T, U> Map<T, Map<U, E>> group2Map(Collection<E> collection, Function<E, T> key1, Function<E, U> key2) {
|
public static <E, T, U> Map<T, Map<U, E>> group2Map(Collection<E> collection, Function<E, T> key1, Function<E, U> key2) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyMap();
|
return MapUtil.newHashMap();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@ -265,7 +266,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E, T> List<T> toList(Collection<E> collection, Function<E, T> function) {
|
public static <E, T> List<T> toList(Collection<E> collection, Function<E, T> function) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptyList();
|
return CollUtil.newArrayList();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.map(function)
|
.map(function)
|
||||||
@ -286,7 +287,7 @@ public class StreamUtils {
|
|||||||
*/
|
*/
|
||||||
public static <E, T> Set<T> toSet(Collection<E> collection, Function<E, T> function) {
|
public static <E, T> Set<T> toSet(Collection<E> collection, Function<E, T> function) {
|
||||||
if (CollUtil.isEmpty(collection)) {
|
if (CollUtil.isEmpty(collection)) {
|
||||||
return Collections.emptySet();
|
return CollUtil.newHashSet();
|
||||||
}
|
}
|
||||||
return collection.stream()
|
return collection.stream()
|
||||||
.map(function)
|
.map(function)
|
||||||
@ -310,7 +311,7 @@ public class StreamUtils {
|
|||||||
public static <K, X, Y, V> Map<K, V> merge(Map<K, X> map1, Map<K, Y> map2, BiFunction<X, Y, V> merge) {
|
public static <K, X, Y, V> Map<K, V> merge(Map<K, X> map1, Map<K, Y> map2, BiFunction<X, Y, V> merge) {
|
||||||
if (CollUtil.isEmpty(map1) && CollUtil.isEmpty(map2)) {
|
if (CollUtil.isEmpty(map1) && CollUtil.isEmpty(map2)) {
|
||||||
// 如果两个 map 都为空,则直接返回空的 map
|
// 如果两个 map 都为空,则直接返回空的 map
|
||||||
return Collections.emptyMap();
|
return MapUtil.newHashMap();
|
||||||
} else if (CollUtil.isEmpty(map1)) {
|
} else if (CollUtil.isEmpty(map1)) {
|
||||||
// 如果 map1 为空,则直接处理返回 map2
|
// 如果 map1 为空,则直接处理返回 map2
|
||||||
return toMap(map2.entrySet(), Map.Entry::getKey, entry -> merge.apply(null, entry.getValue()));
|
return toMap(map2.entrySet(), Map.Entry::getKey, entry -> merge.apply(null, entry.getValue()));
|
||||||
|
@ -49,7 +49,7 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String flowName, Long instId, List<String> messageType, String message) {
|
public void sendMessage(String flowName, Long instId, List<String> messageType, String message) {
|
||||||
if (CollUtil.isNotEmpty(messageType)) {
|
if (CollUtil.isEmpty(messageType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IFlwTaskService flwTaskService = SpringUtils.getBean(IFlwTaskService.class);
|
IFlwTaskService flwTaskService = SpringUtils.getBean(IFlwTaskService.class);
|
||||||
|
Reference in New Issue
Block a user