From: Roland Häder Date: Thu, 16 Apr 2020 22:23:56 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5841479ad64cbd370e9ef13c4180bfec40a4af6b;p=jcontacts-core.git Continued: - don't use primary key in equals()/hashCode() methods, better try to distinct entities with other properties Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontacts/model/contact/UserContact.java b/src/org/mxchange/jcontacts/model/contact/UserContact.java index 3149586..3015382 100644 --- a/src/org/mxchange/jcontacts/model/contact/UserContact.java +++ b/src/org/mxchange/jcontacts/model/contact/UserContact.java @@ -317,9 +317,7 @@ public class UserContact implements Contact { final Contact other = (Contact) object; - if (!Objects.equals(this.getContactId(), other.getContactId())) { - return false; - } else if (!Objects.equals(this.getContactCity(), other.getContactCity())) { + if (!Objects.equals(this.getContactCity(), other.getContactCity())) { return false; } else if (!Objects.equals(this.getContactEmailAddress(), other.getContactEmailAddress())) { return false; @@ -561,7 +559,6 @@ public class UserContact implements Contact { hash = 29 * hash + Objects.hashCode(this.getContactPersonalTitle()); hash = 29 * hash + Objects.hashCode(this.getContactHouseNumber()); hash = 29 * hash + Objects.hashCode(this.getContactHouseNumberExtension()); - hash = 29 * hash + Objects.hashCode(this.getContactId()); hash = 29 * hash + Objects.hashCode(this.getContactStreet()); hash = 29 * hash + Objects.hashCode(this.getContactTitle());