public static <T> List<T> copyPropertiesOfList(List<?> sourceList, Class<T> targetClass, boolean useConverter) { if (CollectionUtils.isEmpty(sourceList)) { return Collections.emptyList(); } List<T> resultList = new ArrayList<>(sourceList.size()); for (Object o : sourceList) { T t = null; try { t = targetClass.newInstance(); copyPropertiesOfList(o, t, useConverter); resultList.add(t); } catch (Exception e) { throw new RuntimeException(e); } } return resultList; } private static <T>void copyPropertiesOfList(Object soruces, T target, boolean useConverter){ if (useConverter) copyProperties(soruces, target, useConverter); else copyProperties(soruces, target); }
java 两个list之间复制(beanUtils的copyproperties)
林鸟鸟2023-08-23 8:43
相关推荐
执笔论英雄7 分钟前
【RL】async原理z***94848 分钟前
Java进阶07 嵌套类python百炼成钢10 分钟前
43.Linux LCD驱动w***H65010 分钟前
Springboot项目:使用MockMvc测试get和post接口(含单个和多个请求参数场景)橘子编程10 分钟前
仓颉语言:华为新一代编程利器a***131411 分钟前
Spring Boot 条件注解:@ConditionalOnProperty 完全解析axihaihai11 分钟前
maven的构建问题tgethe12 分钟前
Java注解稚辉君.MCA_P8_Java15 分钟前
DeepSeek Java 多线程打印的12种实现方法代码不停20 分钟前
Java栈题目练习