This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 9126402567 Use Eclipse generated hashCode() and equals() with some
modifications
9126402567 is described below
commit 9126402567bdde8518f25c406fb49b7cc755eb1a
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Jul 10 08:58:45 2026 +0100
Use Eclipse generated hashCode() and equals() with some modifications
---
.../tribes/tipis/AbstractReplicatedMap.java | 23 ++++++++--------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
index 5a93cb0118..24e1b9efce 100644
--- a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
@@ -1764,27 +1764,20 @@ public abstract class AbstractReplicatedMap<K, V>
@Override
public int hashCode() {
- return key == null ? 0 : key.hashCode();
+ return Objects.hashCode(key) ^ Objects.hashCode(value);
}
@Override
- public boolean equals(Object o) {
- if (!(o instanceof MapEntry)) {
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof MapEntry)) {
return false;
}
@SuppressWarnings("rawtypes")
- MapEntry other = (MapEntry) o;
- if (key == null) {
- if (value == null) {
- return other.key == null && other.value == null;
- } else {
- return other.key == null && value.equals(other.value);
- }
- }
- if (value == null) {
- return key.equals(other.key) && other.value == null;
- }
- return key.equals(other.key) && value.equals(other.value);
+ MapEntry other = (MapEntry) obj;
+ return Objects.equals(key, other.key) && Objects.equals(value,
other.value);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]