diff --git a/arduino-core/src/cc/arduino/contributions/DownloadableContributionVersionComparator.java b/arduino-core/src/cc/arduino/contributions/DownloadableContributionVersionComparator.java index b7f9959a4..f500a9e41 100644 --- a/arduino-core/src/cc/arduino/contributions/DownloadableContributionVersionComparator.java +++ b/arduino-core/src/cc/arduino/contributions/DownloadableContributionVersionComparator.java @@ -33,15 +33,9 @@ import java.util.Comparator; public class DownloadableContributionVersionComparator implements Comparator { - 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()); } diff --git a/arduino-core/src/cc/arduino/contributions/VersionComparator.java b/arduino-core/src/cc/arduino/contributions/VersionComparator.java index c9ec5ca81..af6a1fdb3 100644 --- a/arduino-core/src/cc/arduino/contributions/VersionComparator.java +++ b/arduino-core/src/cc/arduino/contributions/VersionComparator.java @@ -61,7 +61,7 @@ public class VersionComparator implements Comparator { 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 { 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()); + } }