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