jun-he commented on a change in pull request #357: Add in and not in predicates
URL: https://github.com/apache/incubator-iceberg/pull/357#discussion_r315009493
 
 

 ##########
 File path: api/src/main/java/org/apache/iceberg/util/CharSequenceWrapper.java
 ##########
 @@ -49,21 +50,22 @@ public boolean equals(Object other) {
     if (this == other) {
       return true;
     }
-    if (other == null || getClass() != other.getClass()) {
+    if (other == null) {
       return false;
     }
 
-    CharSequenceWrapper that = (CharSequenceWrapper) other;
-    return Comparators.charSequences().compare(wrapped, that.wrapped) == 0;
+    if (other instanceof CharSequence) {
+      return Comparators.charSequences().compare(wrapped, (CharSequence) 
other) == 0;
+    } else if (other instanceof CharSequenceWrapper) {
+      CharSequenceWrapper that = (CharSequenceWrapper) other;
+      return Comparators.charSequences().compare(wrapped, that.wrapped) == 0;
+    } else {
+      return false;
+    }
   }
 
   @Override
   public int hashCode() {
-    int result = 177;
-    for (int i = 0; i < wrapped.length(); i += 1) {
-      char ch = wrapped.charAt(i);
-      result = 31 * result + (int) ch;
-    }
-    return result;
+    return wrapped.hashCode();
 
 Review comment:
   Thanks for the comments. Done.
   

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


With regards,
Apache Git Services

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

Reply via email to