1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

Slightly improved DownloadableContributionVersionComparator

This commit is contained in:
Cristian Maglie 2019-01-14 17:27:34 +01:00
parent f5f8b7f29c
commit f52fc1fb5e
2 changed files with 6 additions and 8 deletions

View File

@ -33,15 +33,9 @@ import java.util.Comparator;
public class DownloadableContributionVersionComparator implements Comparator<DownloadableContribution> {
private final VersionComparator versionComparator;
public DownloadableContributionVersionComparator() {
versionComparator = new VersionComparator();
}
@Override
public int compare(DownloadableContribution lib1, DownloadableContribution lib2) {
return versionComparator.compare(lib1.getParsedVersion(), lib2.getParsedVersion());
return VersionComparator.compareTo(lib1.getParsedVersion(), lib2.getParsedVersion());
}

View File

@ -61,7 +61,7 @@ public class VersionComparator implements Comparator<String> {
public static boolean greaterThan(String a, String b) {
return compareTo(a, b) > 0;
}
public static boolean greaterThanOrEqual(String a, String b) {
return compareTo(a, b) >= 0;
}
@ -77,4 +77,8 @@ public class VersionComparator implements Comparator<String> {
public static boolean greaterThan(ContributedLibrary a, ContributedLibrary b) {
return greaterThan(a.getParsedVersion(), b.getParsedVersion());
}
public static int compareTo(ContributedLibrary a, ContributedLibrary b) {
return compareTo(a.getParsedVersion(), b.getParsedVersion());
}
}