sclass CloseableMapI extends CloseableItIt { IF1 f; Iterator it; *(IF1 *f, Iterator *it) {} public bool hasNext() { ret it.hasNext(); } public B next() { ret f.get(it.next()); } close { if (it cast AutoCloseable) { it.close(); it = null; } } }