当前位置:网站首页>BeanUtils. Copyproperties cannot copy different list sets problem solving lists.transform function
BeanUtils. Copyproperties cannot copy different list sets problem solving lists.transform function
2022-07-28 05:29:00 【wang0112233】
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>26.0-jre</version>
</dependency>Use Lists.transform
list For source data ( copy object ) price Target
// Source data
List<Pr> list = new ArrayList<>();
// Use lamda
List<DTO> price = Lists.transform(list, (entity) -> {
DTO vo = new DTO();
vo.setCode(entity.getCode());
vo.setName(entity.getCode());
vo.setId(entity.getId());
return vo;
});
// Use function
List<DTO> price = Lists.transform(list, new Function<Pr, DTO>() {
@Nullable
@Override
public DTO apply(@Nullable Pr entity) {
// Conversion of internal objects
DTO vo = new DTO();
vo.setCode(entity.getCode());
vo.setName(entity.getName());
vo.setId(entity.getId());
return vo;
}
});边栏推荐
- 【CVPR2022 oral】Balanced Multimodal Learning via On-the-fly Gradient Modulation
- Google browser cannot open localhost:3000. If you open localhost, you will jump to the test address
- 使用navicat或plsql导出csv格式,超过15位数字后面变成000(E+19)的问题
- ES6 new variable modifiers let and const, new basic data type symbol
- 正则表达式
- (黑马)MYSQL初级-高级笔记(博主懒狗)
- 自定义Json返回数据
- 阿里怎么用DDD来拆分微服务?
- New arrow function in ES6
- 【CVPR2022】On the Integration of Self-Attention and Convolution
猜你喜欢

mysql 为查询结果增加序号

2022 summer practice (PowerDesigner tutorial learning record) (first week)

测试开发---自动化测试中的UI测试

The solution after the samesite by default cookies of Chrome browser 91 version are removed, and the solution that cross domain post requests in chrome cannot carry cookies

Message forwarding mechanism -- save your program from crashing

Duoyu security browser will improve the security mode and make users browse more safely

Offline loading of wkwebview and problems encountered

The most detailed installation of windows10 virtual machine, install virtual machine by hand, and solve the problem that the Hyper-V option cannot be found in the home version window

【ARXIV2203】SepViT: Separable Vision Transformer

JMeter related knowledge sorting
随机推荐
从微服务基本概念到核心组件-通过一个实例来讲解和分析
JMeter related knowledge sorting
repackag failed: Unable to find main class
YUV to uiimage
ES6 new variable modifiers let and const, new basic data type symbol
LocalDateTime去掉T,JSONField失效
Framework step by step easy-to-use process
Why is MD5 irreversible, but it may also be decrypted by MD5 free decryption website
Class class added in ES6
【ARXIV2203】SepViT: Separable Vision Transformer
Scanf function of input and output function in C language
IDEA使用dev-tool实现热部署
C language: some self realization of string functions
mybaties foreach多选查询,index循环,取消and/or标签
2022 summer practice (first week)
Redis 之布隆过滤器
21 day SQL punch in summary
Eccv2022 | 29 papers of Tencent Youtu were selected, including face security, image segmentation, target detection and other research directions
24小时内的时间段无交叉
Jsonp single sign on permission verification