class Services {

  private Services() {}

  public static <SERVICE> SERVICE get(Class<SERVICE> serviceType, SERVICE defaultValue) {<FILL_FUNCTION_BODY>}

  public static <SERVICE> List<SERVICE> getAll(Class<SERVICE> serviceType) {
    Iterator<SERVICE> services = ServiceLoader.load(serviceType, Services.class.getClassLoader()).iterator();
    return newArrayList(services);
  }
}


    Iterator<SERVICE> services = ServiceLoader.load(serviceType, Services.class.getClassLoader()).iterator();

    SERVICE result = services.hasNext() ? services.next() : defaultValue;
    if (services.hasNext()) {
      result = defaultValue;
      System.err.println(format("Found multiple implementations for the service provider %s. Using the default: %s",
                                serviceType, result.getClass()));
    }
    return result;
  
<no_super_class>