This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new aa70e9a29b Use Eclipse generated hashCode() and equals() with some 
modifications
aa70e9a29b is described below

commit aa70e9a29b6581efa1f2af112d53adf14ab45fdf
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]

Reply via email to