```java public class Main {
private static final Predicate<Student> predicate;
static {
HashSet<Integer> myset = new HashSet<>();
myset.add(1);
myset.add(2);
myset.add(3);
predicate= s-> myset.contains(s.getClassID());
}
public static void main(String[] args) {
Student dd = new Student(2, "dd");
Student xx = new Student(1, "xx");
Student yy = new Student(6, "yy");
List<Student> list = new ArrayList<>();
list.add(dd);
list.add(xx);
list.add(yy);
List<Student> res = new ArrayList<>();
for (Student student: list){
if (predicate.test(student)) res.add(student);
}
System.out.println(res);
}
} ```