Package io.deephaven.util
Class SafeCloseableArray<ACT extends AutoCloseable>
java.lang.Object
io.deephaven.util.SafeCloseableArray<ACT>
- All Implemented Interfaces:
SafeCloseable
,AutoCloseable
SafeCloseable
that will close non-null values inside an array.
The common use case is to create an array; use the SafeCloseableArray in an ignored try-with-resources variable, and then populate the array within the loop. If the operation fails before populating the array nothing is closed. If the operation fails during or after populating the array the populated values are closed.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
close()
static <ACT extends AutoCloseable>
voidclose
(ACT @NotNull [] array) Close an array ofAutoCloseable
entries, ignoringnull
elements and assigning elements tonull
as they are cleared.
-
Constructor Details
-
SafeCloseableArray
-
-
Method Details
-
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSafeCloseable
-
close
Close an array ofAutoCloseable
entries, ignoringnull
elements and assigning elements tonull
as they are cleared.- Parameters:
array
- The array to operate one
-