copy

parent b762cdb4
......@@ -2,6 +2,8 @@ package com.aps.common.util;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
......@@ -31,7 +33,10 @@ public class DeepCopyUtil {
* 列表深拷贝(很常用)
*/
public static <T> List<T> deepCopyList(List<T> source) {
if (source == null) return List.of();
if (source == null) {
return new ArrayList<>(); // 替换 List.of()
}
try {
String json = objectMapper.writeValueAsString(source);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment