mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-03-31 18:10:26 +08:00
Fix using Java 8 methods
This commit is contained in:
parent
c47dea94e3
commit
bd38c9424f
@ -38,11 +38,11 @@ def buildnumber = System.getenv("TRAVIS_BUILD_NUMBER")
|
||||
if (buildnumber == null)
|
||||
buildnumber = System.getenv("BUILD_NUMBER")
|
||||
if (buildnumber == null)
|
||||
buildnumber = "52"
|
||||
buildnumber = "60"
|
||||
|
||||
def versionroot = System.getenv("VERSION_ROOT")
|
||||
if (versionroot == null)
|
||||
versionroot = "2.7.9"
|
||||
versionroot = "2.7.10"
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = versionroot + '.' + buildnumber
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.jackhuang.hmcl.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@ -38,9 +39,9 @@ public final class ComposedVersionNumber extends VersionNumber {
|
||||
}
|
||||
|
||||
ComposedVersionNumber(String version) {
|
||||
composed = Arrays.stream(version.split("-"))
|
||||
.map(VersionNumber::asVersion)
|
||||
.collect(Collectors.toList());
|
||||
String slice[] = version.split("-");
|
||||
composed = new LinkedList<>();
|
||||
for (String str : slice) composed.add(VersionNumber.asVersion(str));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,6 +51,9 @@ public final class ComposedVersionNumber extends VersionNumber {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return composed.stream().map(VersionNumber::toString).collect(Collectors.joining("-"));
|
||||
List<String> seq = new LinkedList<>();
|
||||
for (VersionNumber str : composed)
|
||||
seq.add(str.toString());
|
||||
return String.join("-", seq);
|
||||
}
|
||||
}
|
@ -20,7 +20,6 @@ package org.jackhuang.hmcl.api;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* If a version string formats x.x.x.x, a {@code IntVersionNumber}
|
||||
|
@ -36,13 +36,6 @@ public abstract class VersionNumber implements Comparable<VersionNumber> {
|
||||
return new StringVersionNumber(version);
|
||||
}
|
||||
|
||||
public static Optional<String> parseVersion(String str) {
|
||||
if (IntVersionNumber.isIntVersionNumber(str))
|
||||
return Optional.of(new IntVersionNumber(str).toString());
|
||||
else
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(VersionNumber o) {
|
||||
return COMPARATOR.compare(this, o);
|
||||
|
Loading…
x
Reference in New Issue
Block a user