code: public static @Nullable String getExistingResourceType(@NotNull ResourceResolver resourceResolver, @NotNull String @NotNull... resourceTypes) {
      for (String path : resourceTypes) {
        if (resourceResolver.getResource(path) != null) {
          return path;
        }
      }
      return null;
    }
docs: From the list of resource types get the first one that exists.
  @param resourceResolver Resource resolver
  @param resourceTypes ResourceTypes
  @return Existing resource type