Brian O'Connor
Committed by Gerrit Code Review

Implementing computeIf in TestConsistentMap

Change-Id: I1bf41342778498cc6242538662e0849d74869222
...@@ -112,7 +112,13 @@ public final class TestConsistentMap<K, V> extends ConsistentMapAdapter<K, V> { ...@@ -112,7 +112,13 @@ public final class TestConsistentMap<K, V> extends ConsistentMapAdapter<K, V> {
112 @Override 112 @Override
113 public Versioned<V> computeIf(K key, Predicate<? super V> condition, 113 public Versioned<V> computeIf(K key, Predicate<? super V> condition,
114 BiFunction<? super K, ? super V, ? extends V> remappingFunction) { 114 BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
115 - return null; 115 + return version(map.compute(key, (k, existingValue) -> {
116 + if (condition.test(existingValue)) {
117 + return remappingFunction.apply(k, existingValue);
118 + } else {
119 + return existingValue;
120 + }
121 + }));
116 } 122 }
117 123
118 @Override 124 @Override
......