- Objects.equals() might be a small overdoze here ...
}
@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;
}
// 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
}
@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;
}
// 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
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;
}