码迷,mamicode.com
首页 > 其他好文 > 详细

使用“流”抽取对象字段

时间:2020-07-06 20:13:17      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:ons   ids   抽取   code   collect   lan   vat   get   osi   

抽取对象数据_流


@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student{
    private String studentId;
    private String studentName;
}

实例1:抽取学生ID

List<Student> studentList = studentRepository.findAll();
Set<String> studentIdSet = studentList.stream()
    .map(Student::getStudentId())
    .collect(Collectors.toSet());

使用“流”抽取对象字段

标签:ons   ids   抽取   code   collect   lan   vat   get   osi   

原文地址:https://www.cnblogs.com/XiaoZhengYu/p/13256310.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!