protected static Version findBestMatch(VersionSpecification versionSpec, Set<Version> versions) {
        Version bestMatch = null;
        for (Version version : versions) {
            // No version is set if getSpecifiedMajor() == null. In that case we allow all versions
            if (version == null || !versionSpec.matches(version)) continue;

            if (bestMatch == null || bestMatch.compareTo(version)<0)
                bestMatch = version;
        }
        return bestMatch;
    }
Finds the best (highest) matching version among a set.

@return the matching version, or null if there are no matches
component/src/main/java/com/yahoo/component/provider/ComponentRegistry.java