(tomcat) branch 11.0.x updated: Use Eclipse generated hashCode() and equals() with some modifications
[email protected] Fri, 10 Jul 2026 07:58:59 +0000
| Newsgroups | gmane.comp.jakarta.tomcat.devel |
|---|---|
| Message-ID | <178367033944.2435338.8364242173221319882@gitbox3-he-fi.apache.org> |
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 77cb18bd93 Use Eclipse generated hashCode() and equals() with some modifications
77cb18bd93 is described below
commit 77cb18bd93f313cfcd59d25285a1ea51c4c3695a
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 c5dcdd2d2e..8748964113 100644
--- a/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
@@ -1759,27 +1759,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);
}
/**