ahuang98 commented on code in PR #16062:
URL: https://github.com/apache/kafka/pull/16062#discussion_r1617827013


##########
clients/src/main/java/org/apache/kafka/common/PartitionInfo.java:
##########
@@ -88,6 +90,28 @@ public Node[] offlineReplicas() {
         return offlineReplicas;
     }
 
+    @Override
+    public int hashCode() {
+        return Objects.hash(topic, partition, leader, replicas, 
inSyncReplicas, offlineReplicas);

Review Comment:
   I think I understand what you're saying, even though `Arrays.hashCode()` is 
called on the params, internally it computes the hash by calling 
`element.hashCode()` on each param (`object#hashCode`). If this were called on 
an int array for instance, this would result in different hashes being produced 
no matter the equality of their contents. However, since this is called on our 
Node array which has an overridden hashCode, we get the expected results still.
   
   I see how 
   ```
   Objects.hash(topic, partition, leader, Arrays.hashCode(replicas), 
Arrays.hashCode(inSyncReplicas), Arrays.hashCode(offlineReplicas));
   ```
   is technically more correct/explicit, I'll make the change.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to