Java 将model集合中某个属性抽出来单独作为一个集合
model:student
抽出student 中的age 单独作为一个集合
//model集合名叫做stuList
//List<Student> stuList
List<String> ageList = stuList.stream().map(Student::getAge).collect(Collectors.toList());
Java 将model集合中某个属性抽出来单独作为一个集合
model:student
抽出student 中的age 单独作为一个集合
//model集合名叫做stuList
//List<Student> stuList
List<String> ageList = stuList.stream().map(Student::getAge).collect(Collectors.toList());