From ed098f4d99a1e1cf7a14cfc14a859db6b5b40481 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 26 Apr 2020 19:22:56 +0200 Subject: [PATCH] Continued: - need to compare all entity properties in equals()/hashCode() methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../jcontacts/model/contact/UserContact.java | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/org/mxchange/jcontacts/model/contact/UserContact.java b/src/org/mxchange/jcontacts/model/contact/UserContact.java index 3015382..0bc9850 100644 --- a/src/org/mxchange/jcontacts/model/contact/UserContact.java +++ b/src/org/mxchange/jcontacts/model/contact/UserContact.java @@ -317,27 +317,41 @@ public class UserContact implements Contact { final Contact other = (Contact) object; - if (!Objects.equals(this.getContactCity(), other.getContactCity())) { + if (!Objects.equals(this.getContactBirthday(), other.getContactBirthday())) { + return false; + } else if (!Objects.equals(this.getContactCity(), other.getContactCity())) { + return false; + } else if (!Objects.equals(this.getContactComment(), other.getContactCountry())) { + return false; + } else if (!Objects.equals(this.getContactCountry(), other.getContactCountry())) { return false; } else if (!Objects.equals(this.getContactEmailAddress(), other.getContactEmailAddress())) { return false; } else if (!Objects.equals(this.getContactFamilyName(), other.getContactFamilyName())) { return false; + } else if (!Objects.equals(this.getContactFaxNumber(), other.getContactFaxNumber())) { + return false; } else if (!Objects.equals(this.getContactFirstName(), other.getContactFirstName())) { return false; - } else if (!Objects.equals(this.getContactStreet(), other.getContactStreet())) { + } else if (!Objects.equals(this.getContactHouseNumber(), other.getContactHouseNumber())) { return false; - } else if (!Objects.equals(this.getContactTitle(), other.getContactTitle())) { + } else if (!Objects.equals(this.getContactHouseNumberExtension(), other.getContactHouseNumberExtension())) { return false; - } else if (!Objects.equals(this.getContactBirthday(), other.getContactBirthday())) { + } else if (!Objects.equals(this.getContactId(), other.getContactId())) { return false; - } else if (!Objects.equals(this.getContactCountry(), other.getContactCountry())) { + } else if (!Objects.equals(this.getContactLandLineNumber(), other.getContactLandLineNumber())) { + return false; + } else if (!Objects.equals(this.getContactMobileNumber(), other.getContactMobileNumber())) { return false; } else if (this.getContactPersonalTitle() != other.getContactPersonalTitle()) { return false; - } else if (!Objects.equals(this.getContactHouseNumber(), other.getContactHouseNumber())) { + } else if (!Objects.equals(this.getContactStreet(), other.getContactStreet())) { return false; - } else if (!Objects.equals(this.getContactHouseNumberExtension(), other.getContactHouseNumberExtension())) { + } else if (!Objects.equals(this.getContactTitle(), other.getContactTitle())) { + return false; + } else if (!Objects.equals(this.getContactZipCode(), other.getContactZipCode())) { + return false; + } else if (!Objects.equals(this.isOwnContact(), other.isOwnContact())) { return false; } @@ -552,15 +566,22 @@ public class UserContact implements Contact { hash = 29 * hash + Objects.hashCode(this.getContactBirthday()); hash = 29 * hash + Objects.hashCode(this.getContactCity()); + hash = 29 * hash + Objects.hashCode(this.getContactComment()); hash = 29 * hash + Objects.hashCode(this.getContactCountry()); hash = 29 * hash + Objects.hashCode(this.getContactEmailAddress()); hash = 29 * hash + Objects.hashCode(this.getContactFamilyName()); + hash = 29 * hash + Objects.hashCode(this.getContactFaxNumber()); hash = 29 * hash + Objects.hashCode(this.getContactFirstName()); - 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.getContactLandLineNumber()); + hash = 29 * hash + Objects.hashCode(this.getContactMobileNumber()); + hash = 29 * hash + Objects.hashCode(this.getContactPersonalTitle()); hash = 29 * hash + Objects.hashCode(this.getContactStreet()); hash = 29 * hash + Objects.hashCode(this.getContactTitle()); + hash = 29 * hash + Objects.hashCode(this.getContactZipCode()); + hash = 29 * hash + Objects.hashCode(this.isOwnContact()); return hash; } -- 2.39.5