学生选课--判断Set中课程是否存在章节举例代码的Course类型不一致问题,应该用Set 类型并用HashSet初始化才准确吧?
public Set<Course> coursesToSelect; public Student student;
/** * 学生类 * @author Administrator * */ public class Student { public String id; public String name; public Set<Course> courses; public Student(String id, String name) { this.id = id; this.name = name; this.courses = new HashSet<>(); } }