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
相关推荐
努力学编程呀(๑•ี_เ•ี๑)5 分钟前
【在 IntelliJ IDEA 中切换项目 JDK 版本】码农小卡拉15 分钟前
深入解析Spring Boot文件加载顺序与加载方式向上的车轮22 分钟前
为什么.NET(C#)转 Java 开发时常常在“吐槽”Java:checked exceptionDragon Wu24 分钟前
Spring Security Oauth2.1 授权码模式实现前后端分离的方案跳动的梦想家h30 分钟前
环境配置 + AI 提效双管齐下坚持就完事了31 分钟前
Java中的集合wjhx40 分钟前
QT中对蓝牙权限的申请,整理一下YCY^v^44 分钟前
JeecgBoot 项目运行指南人间打气筒(Ada)1 小时前
jenkins基于Pipeline发布项目爬山算法1 小时前
Hibernate(88)如何在负载测试中使用Hibernate?