BTree implements Closeable { public byte[] remove(byte[] key) throws IOException { btreeLock.writeLock().lock(); try { byte[] result = null; Node rootNode = readRootNode(); if (rootNode != null) { result = removeFromTree(key, rootNode); if (rootNode.isEmpty()) { if (rootNode.isLeaf()) { rootNodeID = 0; } else { rootNodeID = rootNode.getChildNodeID(0); rootNode.setChildNodeID(0, 0); } writeFileHeader(); if (height >= 0) { height--; } } rootNode.release(); } return result; } finally { btreeLock.writeLock().unlock(); } } BTree(File dataDir, String filenamePrefix, int blockSize, int valueSize);  BTree(File dataDir, String filenamePrefix, int blockSize, int valueSize, boolean forceSync);  BTree(File dataDir, String filenamePrefix, int blockSize, int valueSize, RecordComparator comparator);  BTree(File dataDir, String filenamePrefix, int blockSize, int valueSize, RecordComparator comparator,
			boolean forceSync); File getFile(); boolean delete(); @Override void close(); void sync(); byte[] get(byte[] key); RecordIterator iterateAll(); RecordIterator iterateRange(byte[] minValue, byte[] maxValue); RecordIterator iterateValues(byte[] searchKey, byte[] searchMask); RecordIterator iterateRangedValues(byte[] searchKey, byte[] searchMask, byte[] minValue, byte[] maxValue); long getValueCountEstimate(); long getValueCountEstimate(byte[] minValue, byte[] maxValue); byte[] insert(byte[] value); byte[] remove(byte[] key); void clear(); void print(PrintStream out);  }
@Test public void testRemoveAscending() throws Exception { testAddRandom(); for (byte[] value : TEST_VALUES) { btree.remove(value); } }
@Test public void testRemoveRandom() throws Exception { testAddAscending(); for (byte[] value : RANDOMIZED_TEST_VALUES) { btree.remove(value); } }