private Map<String, Set<String>> calculateHostGroupHostsMap(Cluster cluster) {
    Map<String, Set<String>> map = new HashMap<>();

    List<Host> hosts = new ArrayList<>(cluster.getHosts());
    if (!hosts.isEmpty()) {
      for (Host host : hosts) {
        map.put(host.getHostName(), Collections.singleton(host.getHostName()));
      }
    }

    return map;
  }
Retrieves hosts names mapped by host groups, host name is used as host group identifier
@param cluster cluster for calculating hosts mapping by host groups
@return map "host group name" -> ["host name 1"]
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java