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

    https://github.com/apache/cassandra/pull/224#discussion_r195811425
  
    --- 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 --
    
    So I want to try and be clearer again :-P 
    
    ReplicaList and ReplicaSet both work fine the way they are today. What 
doesn't work is Replicas functions that return an ImmutableContainer because 
those don't implement equals or hashCode for their contents. We should never 
return a Replicas that isn't either an instance of either ReplicaSet or 
ReplicaList with the implied equality and hashCode behavior. 
    
    Java has the Collections class with singleton (which is singleton set) 
singletonList, singletonMap etc. Guava has ImmutableXYZ and the .of methods.
    
    I think Guava got it right having those methods be in the type specific 
class rather than just a generic Collections class.
    
    Otherwise it's all good. ReplicaSet and ReplicaList are wrappers for actual 
set and list implementations so it's not clear we would ever have more than 
just that. I think optimized singleton implementations should be a later 
optimization unless you feel driven.


---

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

Reply via email to