public static int compareByKeyValue(Record record1, Record record2) { checkCompatible(record1, record2) ; int x = Bytes.compare(record1.key, record2.key) ; if ( x == 0 ) { if ( record1.value != null ) x = Bytes.compare(record1.value, record2.value) ; } return x ; }