cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aweisberg <...@git.apache.org>
Subject [GitHub] cassandra pull request #271: 14726
Date Wed, 26 Sep 2018 16:46:35 GMT
Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/271#discussion_r220640980
  
    --- Diff: src/java/org/apache/cassandra/locator/ReplicaMultimap.java ---
    @@ -39,21 +39,28 @@
         public abstract C get(K key);
         public C getIfPresent(K key) { return map.get(key); }
     
    -    public static abstract class Mutable
    -            <K, MutableCollection extends ReplicaCollection.Mutable<?>>
    -            extends ReplicaMultimap<K, MutableCollection>
    +    public static abstract class Builder
    +            <K, B extends ReplicaCollection.Builder<?>>
    +
         {
    -        protected abstract MutableCollection newMutable(K key);
    +        protected abstract B newBuilder(K key);
     
    -        Mutable()
    +        final Map<K, B> map;
    +        Builder()
             {
    -            super(new HashMap<>());
    +            this.map = new HashMap<>();
    +        }
    +
    +        public B get(K key)
    +        {
    +            Preconditions.checkNotNull(key);
    +            return map.computeIfAbsent(key, k -> newBuilder(key));
             }
     
    -        public MutableCollection get(K key)
    +        public B getIfPresent(K key)
    --- End diff --
    
    Unused


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message