Discuss / Java / 练习

练习

Topic source
@Test
public void filterGoodStu() {
    List.of(new Stu("Jack", 65), new Stu("Tom", 57), new Stu("Bob", 82))
            .stream()
            .filter(stu -> stu.getScore() >= 60)
            .forEach(System.out::println); // 重写Stu的toString进行格式输出
}

  • 1

Reply