|
@@ -0,0 +1,26 @@
|
|
1
|
+package com.liang.common.utils;
|
|
2
|
+
|
|
3
|
+import org.apache.poi.ss.formula.functions.T;
|
|
4
|
+
|
|
5
|
+import java.util.ArrayList;
|
|
6
|
+import java.util.List;
|
|
7
|
+
|
|
8
|
+/**
|
|
9
|
+ * @Author ly
|
|
10
|
+ * @Date 2024/6/6 9:49
|
|
11
|
+ * @Verion 1.0
|
|
12
|
+ */
|
|
13
|
+public class LsUtils {
|
|
14
|
+ public static <T> List<T> findDifferentElements(List<T> list1, List<T> list2) {
|
|
15
|
+ List<T> differentElements = new ArrayList<>();
|
|
16
|
+
|
|
17
|
+ // 查找 list1 中不在 list2 中的元素
|
|
18
|
+ for (T element : list1) {
|
|
19
|
+ if (!list2.contains(element)) {
|
|
20
|
+ differentElements.add(element);
|
|
21
|
+ }
|
|
22
|
+ }
|
|
23
|
+
|
|
24
|
+ return differentElements;
|
|
25
|
+ }
|
|
26
|
+}
|