private static void collectRootNodeSources( Collection<PackagingNodeSource> nodeSources, Set<PackagingNodeSource> result) { for (PackagingNodeSource nodeSource : nodeSources) { final Collection<PackagingNodeSource> parentSources = nodeSource.getParentSources(); if (parentSources.isEmpty()) { result.add(nodeSource); } else { collectRootNodeSources(parentSources, result); } } }
private static Collection<PackagingNodeSource> getRootNodeSources( Collection<PackagingNodeSource> nodeSources) { Set<PackagingNodeSource> result = new HashSet<PackagingNodeSource>(); collectRootNodeSources(nodeSources, result); return result; }