Copilot commented on code in PR #15633:
URL: https://github.com/apache/dubbo/pull/15633#discussion_r2278815818


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java:
##########
@@ -305,28 +308,45 @@ public boolean equals(Object o) {
             return false;
         }
         DefaultServiceInstance that = (DefaultServiceInstance) o;
-        boolean equals = Objects.equals(getServiceName(), 
that.getServiceName())
-                && Objects.equals(getHost(), that.getHost())
-                && Objects.equals(getPort(), that.getPort());
+        if (!Objects.equals(getServiceName(), that.getServiceName())
+                || !Objects.equals(getHost(), that.getHost())
+                || !Objects.equals(getPort(), that.getPort())) {
+            return false;
+        }
+
+        Set<String> checkedKeys = new HashSet<>(this.getMetadata().size());

Review Comment:
   The HashSet is initialized with the size of this.getMetadata(), but it will 
only contain keys that are not skipped. Consider initializing without a 
specific size or using a more accurate estimate to avoid unnecessary overhead.
   ```suggestion
           Set<String> checkedKeys = new HashSet<>();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to