java8 lamada 提取集合中每个对象的属性

中台项目中:

MelotPageResult questionRelas = questionStudentRelaBiz.queryByParam(param);

List questionIds = questionRelas.getList().stream().map(QuestionStudentRela::getQuestionId).collect(Collectors.toList());

百度的:
List students = new ArrayList();
网list里插入对象后

List names =students.stream().map(Student::getName).collect(Collectors.toList());

你可能感兴趣的:(java)