This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch support-ivy-as-component-source in repository https://gitbox.apache.org/repos/asf/ant-antlibs-cyclonedx.git
commit 0af0c7cc39b9d56b6d347e0490b3684435b59570 Author: Stefan Bodewig <[email protected]> AuthorDate: Sun Aug 16 12:50:00 2026 +0200 optimize --- src/main/org/apache/ant/cyclonedx/Component.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/org/apache/ant/cyclonedx/Component.java b/src/main/org/apache/ant/cyclonedx/Component.java index 0ff6803..61a6651 100644 --- a/src/main/org/apache/ant/cyclonedx/Component.java +++ b/src/main/org/apache/ant/cyclonedx/Component.java @@ -23,13 +23,13 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.Stack; -import java.util.function.Function; import java.util.stream.Collectors; import org.apache.tools.ant.BuildException; @@ -1190,7 +1190,7 @@ public class Component extends DataType { private String resolveId; private Reference antIvyEngineRef; private String pattern; - private List<Component> templateComponents = new ArrayList<>(); + private Map<String, Component> templateComponents = new HashMap<>(); /** * Sets the configurations to include in the SBOM. @@ -1292,16 +1292,15 @@ public class Component extends DataType { * * @param c nested template component */ - public void addTemplateComponent(Component c) { - templateComponents.add(c); + public void addConfiguredTemplateComponent(Component c) { + templateComponents.put(getTemplateComponentKey(c), c); } Map<String, Component> getTemplateComponents() { - return templateComponents.stream() - .collect(Collectors.toMap(IvyModule::getTemplateComponentKey, Function.identity())); + return templateComponents; } - static String getTemplateComponentKey(Component c) { + private static String getTemplateComponentKey(Component c) { String group = c.getGroup(); if (group == null) { group = "";
