java获取list集合里面的集合指定数据
List<Book> list = Lists.newArrayList(); list.add(new Book("1", "sql基础大全", 200)); list.add(new Book("2", "Java基础", 500)); System.out.println(list); List<String> nameList = list.stream().map(Book -> Book.getName()).collect(Collectors.toList()); System.out.println(nameList);
效果