From 6b5f7c66fc40d7f6099d561e31a34fbd50dd20d3 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 01 七月 2026 15:54:57 +0800
Subject: [PATCH] 初始化项目
---
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java
index 28265a5..b2db78b 100644
--- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java
+++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java
@@ -124,6 +124,22 @@
return from.stream().filter(filter).map(func).filter(Objects::nonNull).collect(Collectors.toSet());
}
+ public static <T, U> Set<U> convertLinkedSet(Collection<T> from, Function<T, U> func) {
+ if (CollUtil.isEmpty(from)) {
+ return new LinkedHashSet<>();
+ }
+ return from.stream().map(func).filter(Objects::nonNull)
+ .collect(Collectors.toCollection(LinkedHashSet::new));
+ }
+
+ public static <T, U> Set<U> convertLinkedSet(Collection<T> from, Function<T, U> func, Predicate<T> filter) {
+ if (CollUtil.isEmpty(from)) {
+ return new LinkedHashSet<>();
+ }
+ return from.stream().filter(filter).map(func).filter(Objects::nonNull)
+ .collect(Collectors.toCollection(LinkedHashSet::new));
+ }
+
public static <T, K> Map<K, T> convertMapByFilter(Collection<T> from, Predicate<T> filter, Function<T, K> keyFunc) {
if (CollUtil.isEmpty(from)) {
return new HashMap<>();
@@ -372,4 +388,14 @@
return false;
}
+ /**
+ * 鎶婂崟鍏冪礌 head 涓庨泦鍚� tail 鍚堝苟鎴愭柊 List锛坔ead 鍦ㄥ墠锛宼ail 椤哄簭淇濈暀锛�
+ */
+ public static <T> List<T> of(T head, Collection<T> tail) {
+ List<T> list = new ArrayList<>();
+ list.add(head);
+ CollUtil.addAll(list, tail);
+ return list;
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.3