]> git.mxchange.org Git - jcontacts-core.git/commitdiff
keeep equals() and hashCode() close to each other
authorRoland Haeder <roland@mxchange.org>
Wed, 24 Feb 2016 12:22:10 +0000 (13:22 +0100)
committerRoland Haeder <roland@mxchange.org>
Wed, 24 Feb 2016 12:22:10 +0000 (13:22 +0100)
src/org/mxchange/jcontacts/contact/UserContact.java

index b25ae2779e5ce1756754b6ef60ab3055111c8026..e3d312aff5f4bfd6ca11fbdbe6fb6cf8b52d59b6 100644 (file)
@@ -294,6 +294,18 @@ public class UserContact implements Contact, Comparable<Contact> {
                                (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<Contact> {
                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
         */