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
相关推荐
Lenyiin4 分钟前
Linux 基础IO松☆21 分钟前
Dart 核心语法精讲:从空安全到流程控制(3)编码者卢布42 分钟前
【App Service】Java应用上传文件功能部署在App Service Windows上报错 413 Payload Too Largeq行1 小时前
Spring概述(含单例设计模式和工厂设计模式)好好研究2 小时前
SpringBoot扩展SpringMVC毕设源码-郭学长2 小时前
【开题答辩全过程】以 高校项目团队管理网站为例,包含答辩的问题和答案玄〤2 小时前
Java 大数据量输入输出优化方案详解:从 Scanner 到手写快读(含漫画解析)tb_first2 小时前
SSM速通3独自破碎E2 小时前
总持续时间可被 60 整除的歌曲