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
相关推荐
快乐就好ya31 分钟前
Java多线程IT学长编程35 分钟前
计算机毕业设计 二手图书交易系统的设计与实现 Java实战项目 附源码+文档+视频讲解CS_GaoMing1 小时前
Centos7 JDK 多版本管理与 Maven 构建问题和注意!艾伦~耶格尔1 小时前
Spring Boot 三层架构开发模式入门man20172 小时前
基于spring boot的篮球论坛系统2401_858120532 小时前
Spring Boot框架下的大学生就业招聘平台S hh2 小时前
【Linux】进程地址空间Java探秘者2 小时前
Maven下载、安装与环境配置详解:从零开始搭建高效Java开发环境攸攸太上2 小时前
Spring Gateway学习2301_786964362 小时前
3、练习常用的HBase Shell命令+HBase 常用的Java API 及应用实例