Simplify code using Java 8 features
[netconf.git] / netconf / netconf-impl / src / main / java / org / opendaylight / netconf / impl / osgi / NetconfCapabilityMonitoringService.java
index 5739488ff539213321caf5a7d9fa453879f29851..f627f15a7e81902889567ab61fc09a7ae7800dd7 100644 (file)
@@ -106,11 +106,8 @@ class NetconfCapabilityMonitoringService implements CapabilityListener, AutoClos
             }
 
             final String currentModuleName = cap.getModuleName().get();
-            Map<String, String> revisionMap = mappedModulesToRevisionToSchema.get(currentModuleName);
-            if (revisionMap == null) {
-                revisionMap = Maps.newHashMap();
-                mappedModulesToRevisionToSchema.put(currentModuleName, revisionMap);
-            }
+            Map<String, String> revisionMap =
+                mappedModulesToRevisionToSchema.computeIfAbsent(currentModuleName, k -> Maps.newHashMap());
 
             final String currentRevision = cap.getRevision().get();
             revisionMap.put(currentRevision, cap.getCapabilitySchema().get());
@@ -205,7 +202,7 @@ class NetconfCapabilityMonitoringService implements CapabilityListener, AutoClos
     }
 
     @Override
-    public synchronized void close() throws Exception {
+    public synchronized void close() {
         listeners.clear();
         capabilities.clear();
     }