diff --git a/core-utils/src/main/java/org/neo4j/gds/utils/ExceptionUtil.java b/core-utils/src/main/java/org/neo4j/gds/utils/ExceptionUtil.java index 494cd70c4e..55326effab 100644 --- a/core-utils/src/main/java/org/neo4j/gds/utils/ExceptionUtil.java +++ b/core-utils/src/main/java/org/neo4j/gds/utils/ExceptionUtil.java @@ -31,6 +31,7 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import java.util.stream.Stream; public final class ExceptionUtil { @@ -95,6 +96,13 @@ public static void closeAll( closeAll(handler, Arrays.asList(closeables)); } + public static void closeAll( + CheckedConsumer handler, + Stream closeables + ) throws E { + closeAll(handler, closeables.iterator()); + } + public static void closeAll( CheckedConsumer handler, Iterable closeables