public static int compareTo(Comparable v1, Comparable v2) {
    return v1 == null ? (v2 == null ? 0 : -1) : v2 == null ? 1 : v1.compareTo(v2);
  }
Helper function to compare two comparable versions with null checks

@param v1
         The first version
@param v2
         The second version
@return {@code -1} if {@code v1} is less than {@code v2}, {@code 1} if it
        is greater, and {@code 0} if they are equal.
ambari-server-spi/src/main/java/org/apache/ambari/server/utils/VersionUtils.java