private void mergeCustomCommands(List<CustomCommandDefinition> parentCommands,
                                   List<CustomCommandDefinition> childCommands) {

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

    for (CustomCommandDefinition childCmd : childCommands) {
      existingNames.add(childCmd.getName());
    }
    if (parentCommands != null) {
      for (CustomCommandDefinition parentCmd : parentCommands) {
        if (! existingNames.contains(parentCmd.getName())) {
          childCommands.add(parentCmd);
        }
      }
    }
  }
Merge custom commands.
Child commands override a parent command of the same name.

@param parentCommands  parent commands
@param childCommands   child commands
ambari-server/src/main/java/org/apache/ambari/server/stack/ComponentModule.java