Source:
<code>public App createApp(AppReference appReference, String contextPath) { DependencyNode rootNode = DependencyTreeParser.parse(appReference.getDependencyTree()); Map<?, ?> rawConfiguration = ConfigurationParser.parse(appReference.getConfiguration()); final Lookup lookup = new Lookup(getFlattenedDependencies(rootNode), new Configuration(rawConfiguration)); final Map<String, Component> createdComponents = new HashMap<>(); rootNode.traverse(dependencyNode -> { if (createdComponents.containsKey(dependencyNode.getArtifactId())) { return; } String componentName = dependencyNode.getArtifactId(); String componentVersion = dependencyNode.getVersion(); String componentContextPath; if (dependencyNode == rootNode) { componentContextPath = Component.ROOT_COMPONENT_CONTEXT_PATH; } else { componentContextPath = dependencyNode.getContextPath(); <START> } <END> ComponentReference componentReference = appReference.getComponentReference(componentContextPath); ClassLoader classLoader = classLoaderProvider.getClassLoader(componentName, componentVersion, componentReference); Component component = createComponent(componentName, componentVersion, componentContextPath, componentReference, classLoader, lookup); lookup.add(component); createdComponents.put(componentName, component); }); Set<Theme> themes = appReference.getThemeReferences().map(this::createTheme).collect(Collectors.toSet()); String appName = rootNode.getArtifactId(); String appContextPath = (contextPath == null) ? rootNode.getContextPath() : contextPath; return new App(appName, appContextPath, lookup, themes, new SessionRegistry(appName)); }</code><technical_language>merge this a single line check. Remove if else branch</technical_language>

Target:
public App createApp(AppReference appReference, String contextPath) { DependencyNode rootNode = DependencyTreeParser.parse(appReference.getDependencyTree()); Map<?, ?> rawConfiguration = ConfigurationParser.parse(appReference.getConfiguration()); final Lookup lookup = new Lookup(getFlattenedDependencies(rootNode), new Configuration(rawConfiguration)); final Map<String, Component> createdComponents = new HashMap<>(); rootNode.traverse(dependencyNode -> { if (createdComponents.containsKey(dependencyNode.getArtifactId())) { return; } String componentName = dependencyNode.getArtifactId(); String componentVersion = dependencyNode.getVersion(); String componentContextPath = (dependencyNode == rootNode) ? Component.ROOT_COMPONENT_CONTEXT_PATH : dependencyNode.getContextPath(); ComponentReference componentReference = appReference.getComponentReference(componentContextPath); ClassLoader classLoader = classLoaderProvider.getClassLoader(componentName, componentVersion, componentReference); Component component = createComponent(componentName, componentVersion, componentContextPath, componentReference, classLoader, lookup); lookup.add(component); createdComponents.put(componentName, component); }); Set<Theme> themes = appReference.getThemeReferences().map(this::createTheme).collect(Collectors.toSet()); String appName = rootNode.getArtifactId(); String appContextPath = (contextPath == null) ? rootNode.getContextPath() : contextPath; return new App(appName, appContextPath, lookup, themes, new SessionRegistry(appName)); }