Author: jbellis
Date: Thu Aug 18 19:41:36 2011
New Revision: 1159374

URL: http://svn.apache.org/viewvc?rev=1159374&view=rev
Log:
update EH.equals to work with any Object
patch by Dave Brosius; reviewed by jbellis for CASSANDRA-3053

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/utils/EstimatedHistogram.java

Modified: 
cassandra/trunk/src/java/org/apache/cassandra/utils/EstimatedHistogram.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/utils/EstimatedHistogram.java?rev=1159374&r1=1159373&r2=1159374&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/EstimatedHistogram.java 
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/EstimatedHistogram.java 
Thu Aug 18 19:41:36 2011
@@ -188,10 +188,18 @@ public class EstimatedHistogram
         return buckets.get(buckets.length() - 1) > 0;
     }
 
-    public boolean equals(EstimatedHistogram o)
+    @Override
+    public boolean equals(Object o)
     {
-        return Arrays.equals(getBucketOffsets(), o.getBucketOffsets()) &&
-               Arrays.equals(getBuckets(false), o.getBuckets(false));
+        if (this == o)
+            return true;
+        
+        if (!(o instanceof EstimatedHistogram))
+            return false;
+        
+        EstimatedHistogram that = (EstimatedHistogram) o;
+        return Arrays.equals(getBucketOffsets(), that.getBucketOffsets()) &&
+               Arrays.equals(getBuckets(false), that.getBuckets(false));
     }
 
     public static class EstimatedHistogramSerializer implements 
ICompactSerializer2<EstimatedHistogram>


Reply via email to