@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);
 }
示例#2
0
 @Override
 public int compare(int index1, int index2) {
   return comparator.compare(
       data, index1 * RECORD_SIZE, KEY_SIZE, data, index2 * RECORD_SIZE, KEY_SIZE);
 }