Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/224#discussion_r195479970
  
    --- Diff: src/java/org/apache/cassandra/locator/Replicas.java ---
    @@ -50,6 +50,30 @@
         public abstract int size();
         protected abstract Collection<Replica> getUnmodifiableCollection();
     
    +
    +    public boolean equals(Object o)
    --- End diff --
    
    Sorry I should have been clearer. We would need AbstractReplicaList and 
AbstractReplicaSet to each implement their own equals and hash code. If you 
look at Java's AbstractList and AbstractSet you will see they implement their 
own equals and hashCode where the two aren't ever equal.
    
    And I think it's not just cargo culting to also do it that way. I think it 
makes sense they should never be equal because sets have unpredictable 
iteration order and it leads to bugs to have it work only some of the time. 
Sets  also use a hash code specific to sets which is the sum of hash codes of 
the elements which makes it order insensitive.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to