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
相关推荐
程序猿零零漆3 分钟前
SpringCloud系列教程:微服务的未来(二十)Seata快速入门、部署TC服务、微服务集成Seata我的K84091 小时前
Spring Boot基本项目结构码农小苏242 小时前
K个不同子数组的数目--滑动窗口--字节--亚马逊CodeClimb2 小时前
【华为OD-E卷 - 最大矩阵和 100分(python、java、c++、js、c)】独自破碎E2 小时前
【4】阿里面试题整理customer089 小时前
【开源免费】基于SpringBoot+Vue.JS体育馆管理系统(JAVA毕业设计)Miketutu10 小时前
Spring MVC消息转换器乔冠宇10 小时前
Java手写简单Merkle树LUCIAZZZ11 小时前
简单的SQL语句的快速复习komo莫莫da11 小时前
寒假刷题Day19