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: [email protected]
For additional commands, e-mail: [email protected]