docs: public static final Integer compare(Object a, Object b) {
          if (a==b) return 0;
          if (a==null || b==null) return null;
          assert a!=null && b!=null;
          if (a instanceof Number && b instanceof Number) {
              Number an = (Number)a;
              Number bn = (Number)b;
              if (Double.isNaN(an.doubleValue()) || Double.isNaN(bn.doubleValue())) {
                  if (Double.isNaN(an.doubleValue()) && Double.isNaN(bn.doubleValue())) return 0;
                  else return null;
              } else {
                  if (an.doubleValue()==bn.doubleValue()) {
                      // Long.compare(long,long) is only available since Java 1.7
                      //return Long.compare(an.longValue(),bn.longValue());
                      return Long.valueOf(an.longValue()).compareTo(Long.valueOf(bn.longValue()));
                  } else {
                      return Double.compare(an.doubleValue(),bn.doubleValue());
                  }
              }
          } else {
              try {
                  return ((Comparable)a).compareTo(b);
              } catch (Throwable e) {
                  log.debug("Could not compare elements: {} - {}",a,b);
                  return null;
              }
          }
      }