使用Java8的stream api 将集合中的对象的某个属性,和对象中子集的属性追加到一个集合中 public static void main(String[] args) { List<Stu> list = new ArrayList<>(); List teaList = new ArrayList(); teaList.add(new Teacher("a")); teaList.add(new Teacher("b")); teaList.add(new Teacher("c")); Stu s = new Stu("A", teaList); list.add(s); List<String> collect = list.stream().map(ss -> ss.getName()).collect(Collectors.toList()); list.stream().forEach(ss -> collect.addAll(ss.getTescherList().stream().map(t -> t.getName()).collect(Collectors.toList()))); collect.stream().forEach(a -> System.out.println(a)); }