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
相关推荐
智码看视界20 分钟前
Day19 Spring Boot启动优化:启动时间从8秒降到2秒北京阿法龙科技有限公司39 分钟前
AR智能眼镜安防应用核心指标:识别距离筑牢防线殘殤血1 小时前
Tomcat的事件监听机制:观察者模式 _汤姆yu1 小时前
面向具身智能的物理视频模拟器:蚂蚁灵波LingBot-Video开源模型全解析SQL-First布道者1 小时前
Spring JDBC Ultra 十边型战士殘殤血1 小时前
Tomcat的事件监听机制:观察者模式Java面试题总结1 小时前
GatewayWorker 从零到一完整指南没钥匙的锁11 小时前
04-Java面向对象基础脉动数据行情1 小时前
Java OkHttp 完整封装 GC COMEX 美黄金实时盘口定时拉取工具类敖行客 Allthinker2 小时前
IM 融合专题:后端架构师的核心修炼