From f2fc15c33aae97c6e45f7dd43d823490d7f47ffc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 19 Mar 2018 22:49:18 +0100 Subject: [PATCH] Continued: - Objects.equals() is an overdose here, as a possible null-reference has already been checked before MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../jaddressbook/model/addressbook/UserAddressbook.java | 4 ++-- .../model/addressbook/entry/UserAddressbookEntry.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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; } -- 2.39.5