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
相关推荐
Pluchon16 小时前
硅基计划4.0 算法 二叉树深搜(DFS)9号达人16 小时前
if-else 优化的折中思考:不是消灭分支,而是控制风险不知道累,只知道类17 小时前
Java 在AWS上使用SDK凭证获取顺序咖啡Beans17 小时前
SpringBoot2.7集成Swagger3.0聪明的笨猪猪17 小时前
Java JVM “垃圾回收(GC)”面试清单(含超通俗生活案例与深度理解)Moniane18 小时前
时序数据库全面重构指南whm277718 小时前
Visual Basic 值传递与地址传递没有bug.的程序员18 小时前
云原生与分布式架构的完美融合:从理论到生产实践村口张大爷18 小时前
Spring Boot 初始化钩子x_feng_x18 小时前
Java从入门到精通 - 集合框架(二)