Sho SHIMIZU
Committed by Gerrit Code Review

Refactor: Use putIfAbsent() to show the intention more clearly

Change-Id: I2fad1709cc6f8827d382a07b55cd89d2814ede36
......@@ -292,9 +292,8 @@ public class ConsistentResourceStore extends AbstractStore<ResourceEvent, Resour
* @return true if the operation succeeds, false otherwise.
*/
private <K, V> boolean appendValues(TransactionalMap<K, List<V>> map, K key, List<V> values) {
List<V> oldValues = map.get(key);
List<V> oldValues = map.putIfAbsent(key, new ArrayList<>(values));
if (oldValues == null) {
map.put(key, new ArrayList<>(values));
return true;
}
......