mynameborat commented on a change in pull request #1138: SAMZA-2302: Add
equals, hashcode and toString to KV
URL: https://github.com/apache/samza/pull/1138#discussion_r314103257
##########
File path: samza-api/src/main/java/org/apache/samza/operators/KV.java
##########
@@ -45,4 +49,30 @@ public K getKey() {
public V getValue() {
return value;
}
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof KV)) {
+ return false;
+ }
+ KV<?, ?> otherKv = (KV<?, ?>) other;
+ return Objects.deepEquals(this.key, otherKv.key)
Review comment:
Does this class assume key and value to be non null? If so, can we add a
preconditions check in the constructor to ensure key and value are non null?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services