Iam*_*MAN 4 java collections hibernate list
public class Student implements java.io.Serializable {
private long studentId;
private String studentName;
private Set<Course> courses = new HashSet<Course>(0);
public Student() {
}
public Student(String studentName) {
this.studentName = studentName;
}
public Student(String studentName, Set<Course> courses) {
this.studentName = studentName;
this.courses = courses;
}
public long getStudentId() {
return this.studentId;
}
public void setStudentId(long studentId) {
this.studentId = studentId;
}
public String getStudentName() {
return this.studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public Set<Course> getCourses() {
return this.courses;
}
public void setCourses(Set<Course> courses) {
this.courses = courses;
}
Run Code Online (Sandbox Code Playgroud)
}
他们在这里使用Hashset来获取课程.我怀疑是否可以使用列表来获取这些课程.我在互联网上读到列表以指定顺序获取vaues并允许列表中的重复项.而在集合中它没有任何订单,也不会允许重复.我想知道我应该在哪里使用集合和列表?谁有人建议?
| 归档时间: |
|
| 查看次数: |
619 次 |
| 最近记录: |