public Set<String> unsupportedServices(Cluster cluster, String stackName, String stackVersion) {
    return cluster.getServices().keySet().stream()
      .filter(serviceName -> !isServiceSupported(serviceName, stackName, stackVersion))
      .collect(toSet());
  }
Collects the service names from the cluster which are not supported (service doesn't exist or was deleted) in the given stack.
ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentSupport.java