public class VersionComparator extends Object implements Comparator<String>
Constructor and Description |
---|
VersionComparator()
Default constructor which creates a comparator that is not revision aware.
|
VersionComparator(boolean versionEndsWithRevision,
boolean numericIncreasingRevision)
Constructor to fine-tune the handling of a revision in the version string
|
Modifier and Type | Method and Description |
---|---|
int |
compare(String version1,
String version2)
Compares the version.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public VersionComparator()
public VersionComparator(boolean versionEndsWithRevision, boolean numericIncreasingRevision)
versionEndsWithRevision
- If true, the last part of the version is always interpreted as revisionnumericIncreasingRevision
- if versionEndsWithRevision is true, this parameter defines whether the revision
is a numeric value which increases with every new revision. Only in this case
the revision is compared.public int compare(String version1, String version2)
compare
in interface Comparator<String>
version1
- the version1 (e.g. 1.0.1)version2
- the version2 (e.g 1.0)Copyright © 2019 Communote team. All rights reserved.