ygerzhedovich commented on a change in pull request #346:
URL: https://github.com/apache/ignite-3/pull/346#discussion_r713002331



##########
File path: modules/api/src/main/java/org/apache/ignite/table/Tuple.java
##########
@@ -51,6 +52,68 @@ static Tuple create(int capacity) {
         return new TupleImpl(capacity);
     }
 
+    /**
+     * Returns the hash code value for the tuple.
+     * <p>
+     * The hash code of a tuple is defined to be the sum of the hash codes of 
each pair of column name and column value.
+     * This ensures that {@code m1.equals(m2)} implies that {@code 
m1.hashCode()==m2.hashCode()} for any tuples
+     * {@code m1} and {@code m2}, as required by the general contract of 
{@link Object#hashCode}.
+     * <p>
+     * The hash code of a pair of column name and column value {@code i} is 
defined to be:
+     * <pre>(columnName(i).hashCode()) ^ (value(i)==null ? 0 : 
value(i).hashCode())</pre>
+     *
+     * @param tuple Tuple.
+     * @return The hash code value for the tuple.
+     */
+    static int hashCode(Tuple tuple) {
+        int hash = 0;
+
+        for (int idx = 0; idx < tuple.columnCount(); idx++) {
+            String key = tuple.columnName(idx);

Review comment:
       let's rename variable to 'colName' instead of 'key'




-- 
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