时间:2021-12-15 09:13:44 | 栏目:JAVA代码 | 点击:次
List<Bill> billList = new ArrayList<>();
将订单中所有物品的名称提取出来做一个集合
List<String> goodsNameList = billList.stream().map(Bill::getGoodsName).collect(Collectors.toList());
补充: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());