GIT Highest version finder java code
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
public class GITHighestVersionFinder {
public static String highestVersionFinder(List<String> versions) {
return versions.stream().sorted(Comparator.reverseOrder())
.collect(Collectors.toList()).get(0);
}
public static void main(String[] args) {
List<String> versions = Arrays.asList("1.0.1.1", "1.1.1");
System.out.println(highestVersionFinder(versions));
}
}
Comments
Post a Comment