public E get()

in baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicPairedDataMap.java [65:93]


  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(
            values.sizeAsLong(),
            chunk >= offsets.sizeAsLong() - 1
                ? values.sizeAsLong()
                : offsets.get(chunk + 1))
            - 1;
    while (lo <= hi) {
      long index = (lo + hi) >>> 1;
      Pair<Long, E> pair = values.get(index);
      long value = pair.left();
      if (value < key) {
        lo = index + 1;
      } else if (value > key) {
        hi = index - 1;
      } else {
        // found
        return pair.right();
      }
    }
    return null;
  }