From 0802ed9c516ea429f382ada79d7aea65aa8312ba Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 24 Feb 2016 13:22:10 +0100 Subject: [PATCH] keeep equals() and hashCode() close to each other --- .../jcontacts/contact/UserContact.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) 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 */ -- 2.39.5