Skip to content

Commit afccd14

Browse files
chore: modify equals method in entities
1 parent 2fd1b32 commit afccd14

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/kotlin/entity/healthprofessional/HealthProfessionalData.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ object HealthProfessionalData {
4141
}
4242
}
4343

44-
override fun equals(other: Any?): Boolean =
45-
when (other) {
46-
is HealthProfessional -> healthProfessionalId == other.healthProfessionalId
47-
else -> false
48-
}
44+
override fun equals(other: Any?): Boolean = when {
45+
other === this -> true
46+
other is HealthProfessional -> healthProfessionalId == other.healthProfessionalId
47+
else -> false
48+
}
4949

5050
override fun hashCode(): Int {
5151
return healthProfessionalId.hashCode()

src/main/kotlin/entity/user/User.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ data class User(
3232
}
3333
}
3434

35-
override fun equals(other: Any?): Boolean =
36-
when (other) {
37-
is User -> userId == other.userId
38-
else -> false
39-
}
35+
override fun equals(other: Any?): Boolean = when {
36+
other === this -> true
37+
other is User -> userId == other.userId
38+
else -> false
39+
}
4040

4141
override fun hashCode(): Int {
4242
return userId.hashCode()

0 commit comments

Comments
 (0)