### Question:
RMap extends RCollection { @Override public KeyIterator getKeyIterator() throws KitDBException { try (CloseLock ignored = checkClose()) { return getKeyIterator(HEAD_B); } } protected  RMap(DB db); void put(String key, String mkey, byte[] value); void putTTL(String key, String mkey, byte[] value, int ttl); void put(String key, Map<String, byte[]> map); void putMayTTL(String key, int ttl, Map<String, byte[]> map); void putMayTTL(String key, int ttl, String mkey, byte[] value); Map<String, byte[]> get(String key, String... keys); byte[] get(String key, String mkey); void remove(String key, String... keys); @Override void delete(String key); @Override KeyIterator getKeyIterator(); void deleteFast(String key); @Override RIterator<RMap> iterator(String key); @Override Entry getEntry(RocksIterator iterator); @Override int getTtl(String key); @Override void delTtl(String key); @Override void ttl(String key, int ttl); @Override boolean isExist(String key); @Override int size(String key); static byte[] HEAD_B; final static byte[] HEAD_KEY_B; }### Answer:
@Test public void getKeyIterator() throws KitDBException { String head = "getKeyIterator"; RMap map = db.getMap(); int num = 100; Set<String> keys = new HashSet<>(); try { for (int i = 0; i < num; i++) { int num2 = 1000; keys.add(head + i); for (int i1 = 0; i1 < num2; i1++) { map.put(head + i, "hello" + i, ("world" + i).getBytes()); } } Set<String> keys2 = new HashSet<>(); try (KeyIterator keyIterator = db.getMap().getKeyIterator()) { while (keyIterator.hasNext()) { String key = keyIterator.next(); keys2.add(key); map.delete(key); } } Assert.assertTrue(keys.containsAll(keys2)); Assert.assertTrue(keys2.containsAll(keys)); } finally { map.delete(head); } }