config-manager-facade-xml: use lambdas 66/57166/4
authorStephen Kitt <skitt@redhat.com>
Tue, 16 May 2017 15:48:20 +0000 (17:48 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Fri, 15 Sep 2017 20:25:05 +0000 (20:25 +0000)
This series of patches uses lambdas instead of anonymous classes for
functional interfaces when possible. Lambdas are replaced with method
references when appropriate.

Change-Id: I95cb63a6d919392fbc5d169de6870f81e05761be
Signed-off-by: Stephen Kitt <skitt@redhat.com>
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/mapping/config/Config.java

index 7aec494..1b62183 100644 (file)
@@ -151,14 +151,14 @@ public class Config {
 
         Map<String, Multimap<String, ModuleElementResolved>> retVal = Maps.newHashMap();
 
-        for (XmlElement moduleElement : moduleElements) {
-            ResolvingStrategy<ModuleElementResolved> resolvingStrategy = (moduleMapping, moduleElement1,
-                    serviceTracker1, instanceName, moduleNamespace,
-                    defaultStrategy) -> moduleMapping.fromXml(moduleElement1, serviceTracker1, instanceName,
-                            moduleNamespace, defaultStrategy, identityMap, enumResolver);
+        ResolvingStrategy<ModuleElementResolved> resolvingStrategy = (moduleMapping, moduleElement, serviceTracker1,
+                instanceName, moduleNamespace, defaultStrategy) -> moduleMapping.fromXml(moduleElement, serviceTracker1,
+                        instanceName, moduleNamespace, defaultStrategy, identityMap, enumResolver);
 
+        for (XmlElement moduleElement : moduleElements) {
             resolveModule(retVal, serviceTracker, moduleElement, defaultEditStrategyType, resolvingStrategy);
         }
+
         return retVal;
     }
 
@@ -174,18 +174,19 @@ public class Config {
 
         Map<String, Multimap<String, ModuleElementDefinition>> retVal = Maps.newHashMap();
 
-        for (XmlElement moduleElement : moduleElements) {
-            ResolvingStrategy<ModuleElementDefinition> resolvingStrategy = (moduleMapping, moduleElement1,
-                    serviceTracker1, instanceName, moduleNamespace, defaultStrategy) -> {
-                // TODO: add check for conflicts between global and local
-                // edit strategy
-                String perInstanceEditStrategy = moduleElement1.getAttribute(XmlMappingConstants.OPERATION_ATTR_KEY,
-                        XmlMappingConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
-                return new ModuleElementDefinition(instanceName, perInstanceEditStrategy, defaultStrategy);
-            };
+        ResolvingStrategy<ModuleElementDefinition> resolvingStrategy = (moduleMapping, moduleElement, serviceTracker1,
+                instanceName, moduleNamespace, defaultStrategy) -> {
+            // TODO: add check for conflicts between global and local edit
+            // strategy
+            String perInstanceEditStrategy = moduleElement.getAttribute(XmlMappingConstants.OPERATION_ATTR_KEY,
+                    XmlMappingConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
+            return new ModuleElementDefinition(instanceName, perInstanceEditStrategy, defaultStrategy);
+        };
 
+        for (XmlElement moduleElement : moduleElements) {
             resolveModule(retVal, serviceTracker, moduleElement, defaultEditStrategyType, resolvingStrategy);
         }
+
         return retVal;
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.