@Override
 public int compareTo(BinaryWritable<M> other) {
   byte[] thisBytes = serialize();
   byte[] otherBytes = other.serialize();
   int thisLen = thisBytes == null ? 0 : thisBytes.length;
   int otherLen = otherBytes == null ? 0 : otherBytes.length;
   return BytesWritable.Comparator.compareBytes(thisBytes, 0, thisLen, otherBytes, 0, otherLen);
 }