当前位置:网站首页>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);
}
边栏推荐
- Real time data analysis tool
- Yolov5 advanced zero environment rapid creation and testing
- [Matlab GUI] key ID lookup table in keyboard callback
- External sorting and heap size knowledge
- 《一周搞定模电》—集成运算放大器
- Behavior tree file description
- Unity webgl publishing cannot run problem
- 教程1:Hello Behaviac
- Detectron2 draw confusion matrix, PR curve and confidence curve
- Yolov5 advanced 4 train your own data set
猜你喜欢

There is a strong demand for enterprise level data integration services. How to find a breakthrough for optimization?

Self learning neural network series - 8 feedforward neural networks

《一周搞定模电》—负反馈

Yolov5 results Txt visualization

51 single chip microcomputer ROM and ram

计算领域高质量科技期刊分级目录

Basic concept and advanced level of behavior tree

Talk about the development of type-C interface

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

Phpcms V9 mobile phone access computer station one-to-one jump to the corresponding mobile phone station page plug-in
随机推荐
《一周搞定数电》-逻辑门
Self learning neural network series - 7 feedforward neural network pre knowledge
Detectron2 draw confusion matrix, PR curve and confidence curve
Self learning neural network series - 8 feedforward neural networks
行為樹XML文件 熱加載
Self taught programming series - 4 numpy arrays
Edit type information
Bug encountered in training detectron2: the test set cannot be evaluated during training
Phpcms mobile station module implements custom pseudo static settings
Fix the problem that the rich text component of the applet does not support the properties of video cover, autoplay, controls, etc
《单片机原理及应用》——概述
Spark based distributed parallel processing optimization strategy - Merrill Lynch data
《一周搞定模电》—集成运算放大器
Is it safe to dig up money and make new debts
In depth study paper reading target detection (VII) Chinese version: yolov4 optimal speed and accuracy of object detection
Behavior tree XML file hot load
JSON file to XML file
《一周搞定模电》—基本放大电路
《一周搞定模电》—电源电路
"One week's work on Analog Electronics" - Basic amplification circuit