From: Roland Häder Date: Mon, 19 Mar 2018 21:49:18 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f2fc15c33aae97c6e45f7dd43d823490d7f47ffc;p=jaddressbook-core.git Continued: - Objects.equals() is an overdose here, as a possible null-reference has already been checked before Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jaddressbook/model/addressbook/UserAddressbook.java b/src/org/mxchange/jaddressbook/model/addressbook/UserAddressbook.java index 2fa1ea5..f6766a8 100644 --- a/src/org/mxchange/jaddressbook/model/addressbook/UserAddressbook.java +++ b/src/org/mxchange/jaddressbook/model/addressbook/UserAddressbook.java @@ -139,11 +139,11 @@ public class UserAddressbook implements Addressbook { @Override public int compareTo (final Addressbook addressbook) { - // Checkparameter and return 0 if equal + // Check parameter and return 0 if equal if (null == addressbook) { // Should not happen throw new NullPointerException("addressbook is null"); //NOI18N - } else if (Objects.equals(this, addressbook)) { + } else if (addressbook.equals(this)) { // Same object return 0; } diff --git a/src/org/mxchange/jaddressbook/model/addressbook/entry/UserAddressbookEntry.java b/src/org/mxchange/jaddressbook/model/addressbook/entry/UserAddressbookEntry.java index beddfa9..6e42ca4 100644 --- a/src/org/mxchange/jaddressbook/model/addressbook/entry/UserAddressbookEntry.java +++ b/src/org/mxchange/jaddressbook/model/addressbook/entry/UserAddressbookEntry.java @@ -101,11 +101,11 @@ public class UserAddressbookEntry implements AddressbookEntry { @Override public int compareTo (final AddressbookEntry addressbookEntry) { - // For performance reasons + // Parameter should not be NULL if (null == addressbookEntry) { // Should not happen throw new NullPointerException("addressbookEntry is null"); //NOI18N - } else if (Objects.equals(this, addressbookEntry)) { + } else if (addressbookEntry.equals(this)) { // Same object return 0; }