public static void main(String[] args) { List<Person> persons = List.of(new Person("小明", 88), new Person("小黑", 62), new Person("小白", 45), new Person("小黄", 78), new Person("小红", 99), new Person("小林", 58)); // 请使用filter过滤出及格的同学,然后打印名字: persons.stream() .filter(s -> s.score >= 60) .forEach(s -> System.out.println(s.name + " " + s.score)); }
Sign in to make a reply
Deler