From 5841479ad64cbd370e9ef13c4180bfec40a4af6b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 17 Apr 2020 00:23:56 +0200 Subject: [PATCH] Continued: - don't use primary key in equals()/hashCode() methods, better try to distinct entities with other properties MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- src/org/mxchange/jcontacts/model/contact/UserContact.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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()); -- 2.39.5