|
@@ -4,6 +4,7 @@ import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.assertj.core.util.Lists;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -54,4 +55,20 @@ public class ListUtil {
|
|
|
public static <T> List<T> getDeletedList(List<T> listBefore, List<T> listAfter) {
|
|
|
return getAddedList(listAfter, listBefore);
|
|
|
}
|
|
|
+
|
|
|
+ public static <T> Boolean listChanged(List<T> listBefore, List<T> listAfter) {
|
|
|
+ if (listBefore == null) {
|
|
|
+ return listAfter == null;
|
|
|
+ }
|
|
|
+ if (listAfter == null) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return listBefore.retainAll(listAfter) || listAfter.retainAll(listBefore);
|
|
|
+ }
|
|
|
+
|
|
|
+// public static void main(String[] args) {
|
|
|
+// ArrayList<String> list1 = Lists.newArrayList("1", "2", "3");
|
|
|
+// ArrayList<String> list2 = Lists.newArrayList("1", "2", "3");
|
|
|
+// System.out.println(listChanged(list1, list2));
|
|
|
+// }
|
|
|
}
|