Package io.deephaven.util
Class SafeCloseableArray<SCT extends SafeCloseable>
java.lang.Object
io.deephaven.util.SafeCloseableArray<SCT>
- All Implemented Interfaces:
SafeCloseable,AutoCloseable
SafeCloseable that will close non-null values inside of 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 you fail before populating the array nothing is closed, if you fail during or after populating the array the created values are closed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()static <SCT extends SafeCloseable>
voidclose(@NotNull SCT[] array) Close an array ofSafeCloseableentries, ignoringnullelements and assigning elements tonullas they are cleared.
-
Constructor Details
-
SafeCloseableArray
-
-
Method Details
-
close
public final void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSafeCloseable
-
close
Close an array ofSafeCloseableentries, ignoringnullelements and assigning elements tonullas they are cleared.- Parameters:
array- The array to operate one
-