public class StreamDemo {
    public static void main(String[] args) {
        List<Student> list = new ArrayList<>();
        list.add(new Student("CJJ", 101, 22));
        list.add(new Student("CY", 102, 1));
        list.add(new Student("ZYH", 103, 8));
        list.add(new Student("ZX", 104, 20));
        list.add(new Student("ZQ", 105, 21));
        list.stream()
                .peek((stu) -> stu.setId(stu.getId() + 1))
                .filter(student -> student.getAge() > 20)
                .forEach((System.out::println));
    }
}

class Student {
    private String name;
    private int id;
    private int age;

    public Student(String name, int id, int age) {
        this.name = name;
        this.id = id;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\\'' +
                ", id=" + id +
                ", age=" + age +
                '}';
    }
}