Hi,
I wanted to check if there is any real difference between the following two ways to define a Range that would fetch all the keys with given Tuple as prefix
:
- Tuple.range()
- Range.startsWith(tuple.pack())
Just for reference: here is the code snippet for both the methods:
Tuple::
public Range range() {
byte[] p = pack();
return new Range(ByteArrayUtil.join(p, new byte[] {0x0}),
ByteArrayUtil.join(p, new byte[] {(byte)0xff}));
}
Range::
public static Range startsWith(byte[] prefix) {
return new Range(prefix, ByteArrayUtil.strinc(prefix));
}
Want to make sure there is no subtle difference that I am overlooking here (I understand the exact byte[] of the resultant Range will be different with two approaches, but will there be any real semantic difference between the two is one is dealing with Tuple based prefix?
In other words - could Tuple’s range() method have been implemented as Range.startswith(pack())
?
–
thanks,
gaurav