Package org.openrewrite.nodejs.internal
Class StaticVersionComparator
java.lang.Object
org.openrewrite.nodejs.internal.StaticVersionComparator
- All Implemented Interfaces:
Comparator<Version>
Allows for comparison of Version instances.
Note that this comparator only considers the 'parts' of a version, and does not consider the part 'separators'.
This means that it considers `1.1.1 == 1-1-1 == 1.1-1`, and should not be used in cases where this is important.
One example where this comparator is inappropriate is if versions should be retained in a TreeMap/TreeSet.
Copied from org.openrewrite.java.dependencies.internal.StaticVersionComparator.
Copied from org.openrewrite.java.dependencies.internal.StaticVersionComparator.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
StaticVersionComparator
public StaticVersionComparator()
-
-
Method Details
-
compare
Compares 2 versions. Algorithm is inspired by PHP version_compare one.- Specified by:
comparein interfaceComparator<Version>
-