]> git.mxchange.org Git - jphone-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 6 Oct 2022 14:04:38 +0000 (16:04 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 6 Oct 2022 14:04:38 +0000 (16:04 +0200)
- Objects.equals() might be a small overdoze here ...

src/org/mxchange/jphone/model/phonenumbers/landline/LandLineNumber.java
src/org/mxchange/jphone/model/phonenumbers/mobile/MobileNumber.java
src/org/mxchange/jphone/model/phonenumbers/mobileprovider/CellphoneProvider.java

index 4f39bcd9c43bf7b318f49dc2c6a53b4654d2a3bd..fdb6c0b846cd84ce09ffaf5451391747ecd5af3b 100644 (file)
@@ -151,12 +151,12 @@ public class LandLineNumber implements DialableLandLineNumber {
        }
 
        @Override
-       public int compareTo (final DialableLandLineNumber otherNumber) {
+       public int compareTo (final DialableLandLineNumber landLineNumber) {
                // Is the parameter given?
-               if (null == otherNumber) {
+               if (null == landLineNumber) {
                        // Throw NPE
-                       throw new NullPointerException("otherNumber is null"); //NOI18N
-               } else if (otherNumber.equals(this)) {
+                       throw new NullPointerException("Parameter 'landLineNumber' is null"); //NOI18N
+               } else if (Objects.equals(this, landLineNumber)) {
                        // Same object
                        return 0;
                }
@@ -164,11 +164,11 @@ public class LandLineNumber implements DialableLandLineNumber {
                // Init comparisons
                final int[] comparators = {
                        // First country
-                       this.getPhoneCountry().compareTo(otherNumber.getPhoneCountry()),
+                       this.getPhoneCountry().compareTo(landLineNumber.getPhoneCountry()),
                        // Next area code
-                       this.getPhoneAreaCode().compareTo(otherNumber.getPhoneAreaCode()),
+                       this.getPhoneAreaCode().compareTo(landLineNumber.getPhoneAreaCode()),
                        // Last number
-                       this.getPhoneNumber().compareTo(otherNumber.getPhoneNumber())
+                       this.getPhoneNumber().compareTo(landLineNumber.getPhoneNumber())
                };
 
                // Check all values
index eb369b6e830e7652fe71f414bd351fc6676783ba..acd7b4a654578bc180fa61cb46d4810077184e93 100644 (file)
@@ -138,12 +138,12 @@ public class MobileNumber implements DialableMobileNumber {
        }
 
        @Override
-       public int compareTo (final DialableMobileNumber otherNumber) {
+       public int compareTo (final DialableMobileNumber mobileNumber) {
                // Is the parameter given?
-               if (null == otherNumber) {
+               if (null == mobileNumber) {
                        // Throw NPE
-                       throw new NullPointerException("otherNumber is null"); //NOI18N
-               } else if (otherNumber.equals(this)) {
+                       throw new NullPointerException("Paramegter 'mobileNumber' is null"); //NOI18N
+               } else if (Objects.equals(this, mobileNumber)) {
                        // Same object
                        return 0;
                }
@@ -151,9 +151,9 @@ public class MobileNumber implements DialableMobileNumber {
                // Init comparisons
                final int[] comparators = {
                        // First compare provider
-                       MobileProviderUtils.compare(this.getMobileProvider(), otherNumber.getMobileProvider()),
+                       MobileProviderUtils.compare(this.getMobileProvider(), mobileNumber.getMobileProvider()),
                        // Last number
-                       SafeNumberUtils.compare(this.getMobileNumber(), otherNumber.getMobileNumber())
+                       SafeNumberUtils.compare(this.getMobileNumber(), mobileNumber.getMobileNumber())
                };
 
                // Check all values
index e58d2d70055f11cfd687ed0fb20816efdd529db3..803b3681a0b287232d56c52da0d13d8ef26828f6 100644 (file)
@@ -171,7 +171,7 @@ public class CellphoneProvider implements MobileProvider {
                if (null == provider) {
                        // Throw NPE
                        throw new NullPointerException("Parameter 'provider' is null"); //NOI18N
-               } else if (provider.equals(this)) {
+               } else if (Objects.equals(this, provider)) {
                        // Same object
                        return 0;
                }