public class VersionComparator extends Object implements Comparator<String>, Serializable
Modifier and Type | Field and Description |
---|---|
static VersionComparator |
INSTANCE
单例
|
Constructor and Description |
---|
VersionComparator()
默认构造
|
Modifier and Type | Method and Description |
---|---|
int |
compare(String version1,
String version2)
比较两个版本
null版本排在最小:即: |
boolean |
equals(Object object) |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final VersionComparator INSTANCE
public int compare(String version1, String version2)
compare(null, "v1") < 0 compare("v1", "v1") = 0 compare(null, null) = 0 compare("v1", null) > 0 compare("1.0.0", "1.0.2") < 0 compare("1.0.2", "1.0.2a") < 0 compare("1.13.0", "1.12.1c") > 0 compare("V0.0.20170102", "V0.0.20170101") > 0
compare
in interface Comparator<String>
version1
- 版本1version2
- 版本2Copyright © 2021. All rights reserved.