Utility method for getting the first version prior to given version
This commit is contained in:
parent
38085cf90a
commit
f0aae96f11
|
@ -64,10 +64,16 @@ public class VersionUtils {
|
||||||
public static List<Version> allVersions() {
|
public static List<Version> allVersions() {
|
||||||
return Collections.unmodifiableList(SORTED_VERSIONS);
|
return Collections.unmodifiableList(SORTED_VERSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Version getPreviousVersion(Version version) {
|
||||||
|
int index = SORTED_VERSIONS.indexOf(version);
|
||||||
|
assert index > 0;
|
||||||
|
return SORTED_VERSIONS.get(index - 1);
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns the {@link Version} before the {@link Version#CURRENT} */
|
/** Returns the {@link Version} before the {@link Version#CURRENT} */
|
||||||
public static Version getPreviousVersion() {
|
public static Version getPreviousVersion() {
|
||||||
Version version = SORTED_VERSIONS.get(SORTED_VERSIONS.size() - 2);
|
Version version = getPreviousVersion(Version.CURRENT);
|
||||||
assert version.before(Version.CURRENT);
|
assert version.before(Version.CURRENT);
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue