in baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicDataMap.java [97:125]
public E get(Object keyObject) {
long key = (long) keyObject;
long chunk = key >>> 8;
if (chunk >= offsets.sizeAsLong()) {
return null;
}
long lo = offsets.get(chunk);
long hi =
Math.min(
keys.sizeAsLong(),
chunk >= offsets.sizeAsLong() - 1
? keys.sizeAsLong()
: offsets.get(chunk + 1))
- 1;
while (lo <= hi) {
long index = (lo + hi) >>> 1;
Pair<Long, Long> pair = keys.get(index);
long value = pair.left();
if (value < key) {
lo = index + 1;
} else if (value > key) {
hi = index - 1;
} else {
// found
return values.read(pair.right());
}
}
return null;
}