T - 此 Comparator 可以比较的对象类型public interface RawComparator<T> extends Comparator<T>
RawComparator 接口定义了一个基于对象二进制表示的比较方法.
| Modifier and Type | Method and Description |
|---|---|
int |
compare(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
基于对象二进制表示的比较方法.
|
compare, comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongint compare(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
Writable 接口定义了对象序列化和反序列化的接口,序列化过程将对象内容写到内存的
byte数组中,本接口定义了byte数组表示的两个对象的比较方法,即对象比较转为比较 b1[s1, s1+l1) 和 b2[s2, s2+l2)
的二进制内容。
这种直接基于二进制表示的比较函数在某些情况下可以做到比直接将对象反序列化后再进行比较来得高效,对于性能敏感的场景,可以提供本接口的实现。
b1 - 对象1二进制内容所在的byte数组s1 - 对象1二进制内容在b1的起始位置l1 - 对象1二进制内容长度b2 - 对象2二进制内容所在的byte数组s2 - 对象2二进制内容在b2的起始位置l2 - 对象2二进制内容长度Copyright © 2023 Alibaba Cloud Computing. All rights reserved.