cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [1/3] cassandra git commit: Improve MD5Digest.hashCode()
Date Tue, 03 Mar 2015 08:46:01 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 1e74dd0d1 -> 33279dd8c
  refs/heads/trunk 7310c054f -> 7cc51f7ae


Improve MD5Digest.hashCode()

Patch by Robert Stupp; Reviewed by Aleksey Yeschenko for CASSANDRA-8847


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/33279dd8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/33279dd8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/33279dd8

Branch: refs/heads/cassandra-2.1
Commit: 33279dd8c567ce6bcc6fa1c60b1304708a880abc
Parents: 1e74dd0
Author: Robert Stupp <snazy@snazy.de>
Authored: Tue Mar 3 09:44:18 2015 +0100
Committer: Robert Stupp <snazy@snazy.de>
Committed: Tue Mar 3 09:44:18 2015 +0100

----------------------------------------------------------------------
 src/java/org/apache/cassandra/utils/MD5Digest.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/33279dd8/src/java/org/apache/cassandra/utils/MD5Digest.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/MD5Digest.java b/src/java/org/apache/cassandra/utils/MD5Digest.java
index 59c1aba..3f46458 100644
--- a/src/java/org/apache/cassandra/utils/MD5Digest.java
+++ b/src/java/org/apache/cassandra/utils/MD5Digest.java
@@ -30,10 +30,12 @@ import java.util.Arrays;
 public class MD5Digest
 {
     public final byte[] bytes;
+    private final int hashCode;
 
     private MD5Digest(byte[] bytes)
     {
         this.bytes = bytes;
+        hashCode = Arrays.hashCode(bytes);
     }
 
     public static MD5Digest wrap(byte[] digest)
@@ -54,7 +56,7 @@ public class MD5Digest
     @Override
     public final int hashCode()
     {
-        return Arrays.hashCode(bytes);
+        return hashCode;
     }
 
     @Override


Mime
View raw message