You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:33:39 UTC

[GitHub] [geode] dschneider-pivotal commented on a change in pull request #5220: GEODE-8233: added equals and hashCode to RedisData classes

dschneider-pivotal commented on a change in pull request #5220:
URL: https://github.com/apache/geode/pull/5220#discussion_r437037866



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/data/AbstractRedisData.java
##########
@@ -183,4 +184,20 @@ protected void storeChanges(Region<ByteArrayWrapper, RedisData> region, ByteArra
 
   protected abstract boolean removeFromRegion();
 
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof AbstractRedisData)) {
+      return false;
+    }
+    AbstractRedisData that = (AbstractRedisData) o;
+    return getExpirationTimestamp() == that.getExpirationTimestamp();
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(getExpirationTimestamp());

Review comment:
       It is but that is not all that is used. That is all we have on AbstractRedisData. Look at its subclasses and you will see they call super.hashCode (this method) and then mix in their own fields to the hash.




----------------------------------------------------------------
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:
users@infra.apache.org