List<MavenArtifactInfo> (Element config) { List<MavenArtifactInfo> artifacts = new ArrayList<>(); Consumer<Element> addToArtifacts = path -> { String groupId = path.getChildTextTrim("groupId"); String artifactId = path.getChildTextTrim("artifactId"); String version = path.getChildTextTrim("version"); String classifier = path.getChildTextTrim("classifier"); //String type = path.getChildTextTrim("type"); artifacts.add(new MavenArtifactInfo(groupId, artifactId, version, "jar", classifier)); }; for (Element path : config.getChildren("path")) { addToArtifacts.consume(path); } for (Element dependency : config.getChildren("dependency")) { addToArtifacts.consume(dependency); } for (Element annotationProcessorPath : config.getChildren("annotationProcessorPath")) { addToArtifacts.consume(annotationProcessorPath); } return artifacts; }