ahuang98 commented on code in PR #16062:
URL: https://github.com/apache/kafka/pull/16062#discussion_r1614010394
##########
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:
Thanks for the comment! From the docs it looks like `Objects.hash()`
delegates to `Arrays.hashCode()` (when we're passing more than one Object) so
these should be equivalent.
```
/**
* Generates a hash code for a sequence of input values. The hash
* code is generated as if all the input values were placed into an
* array, and that array were hashed by calling {@link
* Arrays#hashCode(Object[])}.
*
* ...
* ...
* <b>Warning: When a single object reference is supplied, the returned
* value does not equal the hash code of that object reference.</b> This
* value can be computed by calling {@link #hashCode(Object)}.
*
* @param values the values to be hashed
* @return a hash value of the sequence of input values
* @see Arrays#hashCode(Object[])
* @see List#hashCode
*/
public static int hash(Object... values) {
return Arrays.hashCode(values);
}
```
--
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]