Пример #1
0
  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;
  }
Пример #2
0
 private Tuple deserialize(int index) {
   SortedByteMap.Entry entry = sortedByteMap.get(index);
   return new Tuple(entry.key(), entry.value());
 }
Пример #3
0
 @Override
 public MemoryPointer memory() {
   return sortedByteMap.memory();
 }
Пример #4
0
 @Override
 public Iterator<Tuple> iterator() {
   return new TupleIterator(sortedByteMap.ascendingIterator());
 }
Пример #5
0
 public Iterator<Tuple> descendingIterator(Key key) {
   return new TupleIterator(sortedByteMap.descendingIterator(key));
 }