BlockRangeIndex { public void delete(K key, V value) { final BlockStartKey<K> lookUp = BlockStartKey.valueOf(key, Long.MIN_VALUE); final DeleteState<K, V> state = new DeleteState<>(); state.next = blocks.floorEntry(lookUp).getValue(); do { state.next.delete(key, value, state); } while (state.next != null); } BlockRangeIndex(long maxBlockSize, PageReplacementPolicy pageReplacementPolicy);  BlockRangeIndex(long maxBlockSize, PageReplacementPolicy pageReplacementPolicy, IndexDataStorage<K, V> dataStorage); int getNumBlocks(); BlockRangeIndexMetadata<K> checkpoint(); void put(K key, V value); void delete(K key, V value); List<V> search(K firstKey, K lastKey); List<V> search(K key); Stream<V> query(K firstKey, K lastKey); Stream<V> query(K key); boolean containsKey(K key); void boot(BlockRangeIndexMetadata<K> metadata);  }
@Test public void testDelete() { BlockRangeIndex<Sized<Integer>, Sized<String>> index = new BlockRangeIndex<>(1024, new RandomPageReplacementPolicy(10)); index.boot(BlockRangeIndexMetadata.empty()); index.put(Sized.valueOf(3), Sized.valueOf("c")); index.put(Sized.valueOf(2), Sized.valueOf("b")); index.put(Sized.valueOf(1), Sized.valueOf("a")); index.delete(Sized.valueOf(1), Sized.valueOf("a")); assertTrue(index.search(Sized.valueOf(1)).isEmpty()); assertEquals(Sized.valueOf("b"), index.search(Sized.valueOf(2)).get(0)); assertEquals(Sized.valueOf("c"), index.search(Sized.valueOf(3)).get(0)); index.delete(Sized.valueOf(2), Sized.valueOf("b")); assertTrue(index.search(Sized.valueOf(2)).isEmpty()); assertEquals(Sized.valueOf("c"), index.search(Sized.valueOf(3)).get(0)); index.delete(Sized.valueOf(3), Sized.valueOf("c")); assertTrue(index.search(Sized.valueOf(3)).isEmpty()); }