public Tuple get(Key key) { int closestIndex = sortedByteMap.floorIndex(key); if (closestIndex < 0 || closestIndex >= sortedByteMap.entryCount()) { return null; } Tuple closestTuple = deserialize(closestIndex); return closestTuple.key().data().equals(key.data()) ? closestTuple : null; }
private Tuple deserialize(int index) { SortedByteMap.Entry entry = sortedByteMap.get(index); return new Tuple(entry.key(), entry.value()); }
@Override public MemoryPointer memory() { return sortedByteMap.memory(); }
@Override public Iterator<Tuple> iterator() { return new TupleIterator(sortedByteMap.ascendingIterator()); }
public Iterator<Tuple> descendingIterator(Key key) { return new TupleIterator(sortedByteMap.descendingIterator(key)); }