### Question:
RMap extends RCollection { @Override public RIterator<RMap> iterator(String key) throws KitDBException { try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); Meta metaV = getMeta(key_b); if (metaV == null) { return null; } Key k_seek = new Key(key_b.length, key_b, metaV.getVersion(), null); RocksIterator iterator = newIterator(SstColumnFamily.DEFAULT); iterator.seek(k_seek.getHead()); RIterator<RMap> rIterator = new RIterator<>(iterator, this, k_seek.getHead()); return rIterator; } } 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 iterator() throws KitDBException { String head = "iterator0"; RMap map = db.getMap(); int num = 1000; try { for (int i = 0; i < num; i++) { map.put(head, "hello" + i, ("world" + i).getBytes()); } Map<String, String> map_chack = new HashMap<>(); try (RIterator<RMap> iterator = map.iterator(head)) { while (iterator.hasNext()) { RMap.Entry entry = iterator.next(); map_chack.put(entry.getKey(), new String(entry.getValue())); } } catch (KitDBException e) { throw e; } for (int i = 0; i < num; i++) { Assert.assertEquals(("world" + i), map_chack.get("hello" + i)); } } finally { map.delete(head); } }