void () { Throwable ex = null; for (Closeable container : Iterators.flat(myMultiMaplets, myMaplets)) { try { container.close(); } catch (Throwable e) { if (ex == null) { ex = e; } } } myMultiMaplets.clear(); myMaplets.clear(); if (ex instanceof IOException) { throw new BuildDataCorruptedException((IOException)ex); } else if (ex != null) { throw new RuntimeException(ex); } }