Make use of Map.getOrDefault 77/33877/1
authorMunir Ahmad <munir.ahmad@bell.ca>
Sat, 3 Mar 2018 00:36:58 +0000 (19:36 -0500)
committerMunir Ahmad <munir.ahmad@bell.ca>
Sat, 3 Mar 2018 00:36:58 +0000 (19:36 -0500)
Change-Id: Ifcd5c9b79179ee9ffd6705990bd4b1991034fb48
Issue-ID: SO-437
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/RollbackData.java

index 64068d2..b650344 100644 (file)
@@ -54,12 +54,8 @@ public class RollbackData implements Serializable {
      * @param value the value
      */
     public void put(String type, String key, String value) {
-        Map<String, Serializable> mapForType = dictionary.get(type);
-
-        if (mapForType == null) {
-            mapForType = new HashMap<String, Serializable>();
-            dictionary.put(type, mapForType);
-        }
+        Map<String, Serializable> mapForType = dictionary
+            .computeIfAbsent(type, k -> new HashMap<String, Serializable>());
 
         mapForType.put(key, value);
     }