commit | 73130f790fdc394f8d1b07cc42fd45609d2a75b0 | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Mon Nov 09 17:10:08 2015 -0800 |
committer | Gerrit Code Review <gerrit@onlab.us> | Tue Nov 10 17:46:55 2015 +0000 |
tree | 94ee0c0d09308923678d1a7f441b4e8bd3bfa5e1 | |
parent | 34c1843d6f07be15804f572b2057bb230a159c11 [diff] |
Refactor: Use putIfAbsent() to show the intention more clearly Change-Id: I2fad1709cc6f8827d382a07b55cd89d2814ede36
diff --git a/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java b/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java index 386d9dd..4d9e3cb 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java +++ b/core/store/dist/src/main/java/org/onosproject/store/newresource/impl/ConsistentResourceStore.java
@@ -292,9 +292,8 @@ * @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; }