当前位置:网站首页>Collection object replication
Collection object replication
2022-06-26 09:22:00 【Java backend Guide】
/**
* Copy of collection data
* @param sources: The data source class
* @param target: Target class ::new(eg: UserVO::new)
* @return
*/
public static <S, T> List<T> copyListProperties(List<S> sources, Supplier<T> target) {
return copyListProperties(sources, target, null);
}
/**
* Copy of collection data with callback function ( You can customize the field copy rules )
* @param sources: The data source class
* @param target: Target class ::new(eg: UserVO::new)
* @param callBack: Callback function
* @return
*/
public static <S, T> List<T> copyListProperties(List<S> sources, Supplier<T> target, BeanCopyUtilCallBack<S, T> callBack) {
List<T> list = new ArrayList<>(sources.size());
for (S source : sources) {
T t = target.get();
copyProperties(source, t);
list.add(t);
if (callBack != null) {
// Callback
callBack.callBack(source, t);
}
}
return list;
}
@FunctionalInterface
public interface BeanCopyUtilCallBack <S, T> {
/**
* Define the default callback method
* @param t
* @param s
*/
void callBack(S t, T s);
}
边栏推荐
- [open source] use phenocv weedcam for more intelligent and accurate weed management
- Fix the problem that the rich text component of the applet does not support the properties of video cover, autoplay, controls, etc
- Principe et application du micro - ordinateur à puce unique - Aperçu
- 《一周搞定模电》—基本放大电路
- Self taught neural network series - 3. First knowledge of neural network
- 《一周搞定模电》—功率放大器
- Applet realizes picture preloading (picture delayed loading)
- thinkphp5手动报错
- Yolov5 advanced camera real-time acquisition and recognition
- 教程1:Hello Behaviac
猜你喜欢

《一周搞定模电》—55定时器

首期Techo Day腾讯技术开放日,628等你

常用电路设计

Pycharm occasionally encounters low disk space

板端电源硬件调试BUG

"One week's work on Analog Electronics" - optocoupler and other components

编辑类型信息

Basic concept and advanced level of behavior tree

"One week's work on Analog Electronics" - Basic amplification circuit

Detectron2 outputs validation loss during training
随机推荐
Merrill Lynch data technology expert team | building a cloud native product system based on containers
Yolov5 advanced III training environment
How to solve the sample imbalance problem in machine learning?
JSON file to XML file
《单片机原理及应用》——概述
How to view the data mini map quickly and conveniently after importing data in origin
Phpcms applet plug-in tutorial website officially launched
3大问题!Redis缓存异常及处理方案总结
Phpcms V9 adds the reading amount field in the background, and the reading amount can be modified at will
《一周搞定模电》—集成运算放大器
行为树的基本概念及进阶
Error importerror: numpy core. multiarray failed to import
Detectron2 draw confusion matrix, PR curve and confidence curve
Real time data analysis tool
Tutorial 1:hello behavioc
集合对象复制
Bug encountered in training detectron2: the test set cannot be evaluated during training
行为树 文件说明
"One week's work on Analog Electronics" - integrated operational amplifier
Live review | smardaten lihongfei interprets the Research Report on China's low / no code industry: the wind direction has changed