fix(student): add hashCode check to equals
This commit is contained in:
@@ -51,8 +51,12 @@ public class Student {
|
|||||||
|
|
||||||
if (obj == null || getClass() != obj.getClass()) {
|
if (obj == null || getClass() != obj.getClass()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.hashCode() != obj.hashCode()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Student student = (Student) obj;
|
Student student = (Student) obj;
|
||||||
|
|
||||||
return Double.compare(averageGrade, student.averageGrade) == 0
|
return Double.compare(averageGrade, student.averageGrade) == 0
|
||||||
|
|||||||
Reference in New Issue
Block a user