@Override
  public Collection<HostGroup> getHostGroupsForComponent(String component) {
    Collection<HostGroup> resultGroups = new HashSet<>();
    for (HostGroup group : hostGroups.values() ) {
      if (group.getComponentNames().contains(component)) {
        resultGroups.add(group);
      }
    }
    return resultGroups;
  }
Get host groups which contain a component.

@param component   component name

@return collection of host groups which contain the specified component
ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java