private List<KerberosKeytabPrincipalDAO.KerberosKeytabPrincipalFilter> splitServiceFilter(Map<String, ? extends Collection<String>> serviceComponentFilter) {
    if (serviceComponentFilter != null && serviceComponentFilter.size() > 0) {
      Set<String> serviceSet = new HashSet<>();
      Set<String> componentSet = new HashSet<>();
      Set<String> serviceOnlySet = new HashSet<>();

      // Split the filter into a service/component filter or a service-only filter.
      for (Map.Entry<String, ? extends Collection<String>> entry : serviceComponentFilter.entrySet()) {
        String serviceName = entry.getKey();
        Collection<String> serviceComponents = entry.getValue();

        if((serviceComponents == null) || serviceComponents.contains("*")) {
          serviceOnlySet.add(serviceName);
        }
        else {
          serviceSet.add(serviceName);
          componentSet.addAll(serviceComponents);
        }
      }

      List<KerberosKeytabPrincipalDAO.KerberosKeytabPrincipalFilter> result = new ArrayList<>();
      // Handle the service/component filter
      if (serviceSet.size() > 0) {
        result.add(KerberosKeytabPrincipalDAO.KerberosKeytabPrincipalFilter.createFilter(
          null,
          serviceSet,
          componentSet,
          null
        ));
      }
      // Handler the service/* filter
      if (serviceOnlySet.size() > 0) {
        result.add(KerberosKeytabPrincipalDAO.KerberosKeytabPrincipalFilter.createFilter(
          null,
          serviceOnlySet,
          null,
          null
        ));
      }
      if (result.size() > 0) {
        return result;
      }
    }

    return Lists.newArrayList(KerberosKeytabPrincipalDAO.KerberosKeytabPrincipalFilter.createEmptyFilter());
  }
This function split serviceComponentFilter to two filters, one with specific components, and another one with service
only. Can return only one filter if filter contain only one type of mapping(whole service or component based)
or empty filter if no serviceComponentFilter provided.

@param serviceComponentFilter
@return
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/stageutils/KerberosKeytabController.java