Override hashCode and equals to avoid repeated item (#8207)
This commit is contained in:
parent
8401b8c836
commit
8838ae1417
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.client.naming.remote.gprc.redo.data;
|
package com.alibaba.nacos.client.naming.remote.gprc.redo.data;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nacos naming redo data.
|
* Nacos naming redo data.
|
||||||
*
|
*
|
||||||
@ -127,4 +129,22 @@ public abstract class RedoData<T> {
|
|||||||
*/
|
*/
|
||||||
REMOVE;
|
REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
RedoData<?> redoData = (RedoData<?>) o;
|
||||||
|
return registered == redoData.registered && unregistering == redoData.unregistering
|
||||||
|
&& serviceName.equals(redoData.serviceName) && groupName.equals(redoData.groupName) && data.equals(redoData.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(serviceName, groupName, registered, unregistering, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user