diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..a590144 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..105dbd3 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..eba6e1f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/dev/model/Student.java b/src/main/java/dev/model/Student.java index f0484f4..f9bdbb1 100644 --- a/src/main/java/dev/model/Student.java +++ b/src/main/java/dev/model/Student.java @@ -40,31 +40,20 @@ public class Student { @Override public int hashCode() { - - // TODO: - // Return custom hash - - // Example: - // return id % 97; - - return 0; + return this.getId() % 97; } @Override public boolean equals(Object obj) { + if (obj == null) return false; + + if (this == obj) return true; - // TODO: + if (this.getClass() != obj.getClass()) return false; - // Step 1: - // Check null + Student other = (Student) obj; - // Step 2: - // Convert obj to Student - - // Step 3: - // Compare IDs - - return false; + return this.id == other.id; } @Override