class KubernetesVersionPriority {

  private KubernetesVersionPriority() {
  }

  /**
   * Returns the version with the highest priority for the given list of versions.
   *
   * @param versions the versions to pick the version with the highest priority from
   * @return the version with the highest priority
   * @see CustomResourceDefinitionVersion#getName()
   * @see CustomResourceDefinitionSpec#getVersions()
   * @see KubernetesVersionPriority
   */
  public static String highestPriority(List<String> versions) {
    List<Version> byPriority = sortByPriority(versions);
    if (byPriority.isEmpty()) {
      return null;
    }
    return byPriority.get(0).getFull();
  }

  private static List<Version> sortByPriority(List<String> versions) {
    if (versions == null || versions.isEmpty()) {
      return Collections.emptyList();
    }
    return versions.stream()
        .map(KubernetesVersionFactory::create)
        .sorted(Collections.reverseOrder())
        .collect(Collectors.toList());
  }

  /**
   * Returns a sorted list of resources, for example, {@link CustomResourceDefinitionVersion}s,
   * ordered from highest to lowest priority.
   *
   * @param resources the resources to sort
   * @param versionProvider a function to provide the version from the resource
   * @param <T> the resource type
   * @return the sorted list of resources
   * @see CustomResourceDefinitionVersion#getName()
   * @see CustomResourceDefinitionSpec#getVersions()
   * @see KubernetesVersionPriority
   */
  public static <T> List<T> sortByPriority(List<T> resources, Function<T, String> versionProvider) {<FILL_FUNCTION_BODY>}
}

    Utils.checkNotNull(versionProvider, "versionProvider function can't be null");
    if (resources == null || resources.isEmpty()) {
      return Collections.emptyList();
    }

    return resources.stream()
        .sorted(Comparator.comparing(o -> KubernetesVersionFactory.create(versionProvider.apply(o)), Comparator.reverseOrder()))
        .collect(Collectors.toList());
  
<no_super_class>