Increases readability a bit

This commit is contained in:
Kristian Knarvik 2021-08-03 12:28:21 +02:00
parent dc362eb2c8
commit 00cfe78491

View File

@ -87,7 +87,8 @@ public final class Updater {
public static boolean isVersionHigher(String oldVersion, String newVersion) { public static boolean isVersionHigher(String oldVersion, String newVersion) {
String[] oldVersionParts = oldVersion.split("\\."); String[] oldVersionParts = oldVersion.split("\\.");
String[] newVersionParts = newVersion.split("\\."); String[] newVersionParts = newVersion.split("\\.");
for (int i = 0; i < Math.max(oldVersionParts.length, newVersionParts.length); i++) { int versionLength = Math.max(oldVersionParts.length, newVersionParts.length);
for (int i = 0; i < versionLength; i++) {
int oldVersionNumber = oldVersionParts.length > i ? Integer.parseInt(oldVersionParts[i]) : 0; int oldVersionNumber = oldVersionParts.length > i ? Integer.parseInt(oldVersionParts[i]) : 0;
int newVersionNumber = newVersionParts.length > i ? Integer.parseInt(newVersionParts[i]) : 0; int newVersionNumber = newVersionParts.length > i ? Integer.parseInt(newVersionParts[i]) : 0;
if (newVersionNumber != oldVersionNumber) { if (newVersionNumber != oldVersionNumber) {