code: public static <T> Optional<T> findFirst(Class<T> clazz, Predicate<? super T> predicate) {
      ServiceLoader<T> load = ServiceLoader.load(clazz);
      Stream<T> stream = StreamSupport.stream(load.spliterator(), false);
      return stream.filter(predicate).findFirst();
    }
docs: Finds the first implementation of the given service type using the given predicate to filter
  out found service types and creates its instance.
  
  @param clazz service type
  @param predicate service type predicate
  @return the first implementation of the given service type