Consistent equals/hashCode style (and related polishing)
This commit is contained in:
@@ -532,14 +532,9 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof SimpSubscription otherSubscription)) {
|
||||
return false;
|
||||
}
|
||||
return (getId().equals(otherSubscription.getId()) &&
|
||||
ObjectUtils.nullSafeEquals(getSession(), otherSubscription.getSession()));
|
||||
return (this == other || (other instanceof SimpSubscription that &&
|
||||
getId().equals(that.getId()) &&
|
||||
ObjectUtils.nullSafeEquals(getSession(), that.getSession())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -90,20 +90,15 @@ public class GenericMessage<T> implements Message<T>, Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof GenericMessage<?> otherMsg)) {
|
||||
return false;
|
||||
}
|
||||
// Using nullSafeEquals for proper array equals comparisons
|
||||
return (ObjectUtils.nullSafeEquals(this.payload, otherMsg.payload) && this.headers.equals(otherMsg.headers));
|
||||
return (this == other || (other instanceof GenericMessage<?> that &&
|
||||
ObjectUtils.nullSafeEquals(this.payload, that.payload) && this.headers.equals(that.headers)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// Using nullSafeHashCode for proper array hashCode handling
|
||||
return (ObjectUtils.nullSafeHashCode(this.payload) * 23 + this.headers.hashCode());
|
||||
return ObjectUtils.nullSafeHashCode(this.payload) * 23 + this.headers.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,14 +59,9 @@ public class TestSimpSubscription implements SimpSubscription {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof SimpSubscription otherSubscription)) {
|
||||
return false;
|
||||
}
|
||||
return (ObjectUtils.nullSafeEquals(getSession(), otherSubscription.getSession()) &&
|
||||
this.id.equals(otherSubscription.getId()));
|
||||
return (this == other || (other instanceof SimpSubscription that &&
|
||||
ObjectUtils.nullSafeEquals(getSession(), that.getSession()) &&
|
||||
this.id.equals(that.getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user