code: static int nullCompare(Object first, Object second) {
          if (first == null) {
              if (second != null) {
                  return 1;
              }
          } else if (second == null) {
              return -1;
          }
          return 0;
      }
docs: Comparison orders null high.