From: Roland Haeder Date: Wed, 24 Feb 2016 12:22:10 +0000 (+0100) Subject: keeep equals() and hashCode() close to each other X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0802ed9c516ea429f382ada79d7aea65aa8312ba;p=jcontacts-core.git keeep equals() and hashCode() close to each other --- diff --git a/src/org/mxchange/jcontacts/contact/UserContact.java b/src/org/mxchange/jcontacts/contact/UserContact.java index b25ae27..e3d312a 100644 --- a/src/org/mxchange/jcontacts/contact/UserContact.java +++ b/src/org/mxchange/jcontacts/contact/UserContact.java @@ -294,6 +294,18 @@ public class UserContact implements Contact, Comparable { (this.getContactFamilyName().toLowerCase().equals(contact.getContactFamilyName().toLowerCase()))); } + @Override + public int hashCode () { + // Validate contactGender instance + assert (this.getContactGender() instanceof Gender) : "gender is not set."; //NOI18N + + int hash = 7; + hash = 79 * hash + Objects.hashCode(this.getContactFamilyName()); + hash = 79 * hash + this.getContactGender().hashCode(); + hash = 79 * hash + Objects.hashCode(this.getContactFirstName()); + return hash; + } + @Override public Date getContactBirthday () { return this.contactBirthday; @@ -480,18 +492,6 @@ public class UserContact implements Contact, Comparable { this.contactZipCode = contactZipCode; } - @Override - public int hashCode () { - // Validate contactGender instance - assert (this.getContactGender() instanceof Gender) : "gender is not set."; //NOI18N - - int hash = 7; - hash = 79 * hash + Objects.hashCode(this.getContactFamilyName()); - hash = 79 * hash + this.getContactGender().hashCode(); - hash = 79 * hash + Objects.hashCode(this.getContactFirstName()); - return hash; - } - /** * Initialization with fake contactGender UNKNOWN */