private void mergeComponentDependencies(List<DependencyInfo> parentDependencies,
                                          List<DependencyInfo> childDependencies) {

    Collection<String> existingNames = new HashSet<>();

    for (DependencyInfo childDependency : childDependencies) {
      existingNames.add(childDependency.getName());
    }
    if (parentDependencies != null) {
      for (DependencyInfo parentDependency : parentDependencies) {
        if (! existingNames.contains(parentDependency.getName())) {
          childDependencies.add(parentDependency);
        }
      }
    }
  }
Merge component dependencies.
Child dependencies override a parent dependency of the same name.

@param parentDependencies  parent dependencies
@param childDependencies   child dependencies
ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java