void (PersistentEnumerator<?> enumerator) { myObjects.add(new PersistentObject() { @Override public void flush() { if (enumerator.isDirty()) { enumerator.force(); } } @Override public void close() throws IOException { enumerator.close(); } }); }