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:
parent
f5f8b7f29c
commit
f52fc1fb5e
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user