org.jboss.logging.processor.util
Class VersionComparator
java.lang.Object
org.jboss.logging.processor.util.VersionComparator
- All Implemented Interfaces:
- Comparator<String>
public class VersionComparator
- extends Object
- implements Comparator<String>
Compares 2 different version strings.
The version strings must be valid integers separated by .
(dots).
Date: 09.11.2011
- Author:
- James R. Perkins
Method Summary |
int |
compare(String o1,
String o2)
|
static int |
compareVersion(String version1,
String version2)
Compares the first version to the second version and returns, 0 if they are equal, a value less than 0 if the
first version is less than the second version or a value greater than 0 if the first version is greater than
the second version. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static VersionComparator INSTANCE
compareVersion
public static int compareVersion(String version1,
String version2)
- Compares the first version to the second version and returns, 0 if they are equal, a value less than 0 if the
first version is less than the second version or a value greater than 0 if the first version is greater than
the second version.
- Parameters:
version1
- the first version to compare.version2
- the second version to compare.
- Returns:
- a value of 0 if the versions are equal, less than 0 if
version1
is less than version2
,
a value greater than 0 if version1
is greater than version2
.
compare
public int compare(String o1,
String o2)
- Specified by:
compare
in interface Comparator<String>
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.