asCloseable

fun <T> <Error class: unknown class><T>.asCloseable(onClose: () -> Unit): CloseableSequence<T>

Wraps a Sequence into a CloseableSequence with a custom close action.

This function allows you to associate a specific action to be executed when the resulting CloseableSequence is closed.

Return

a CloseableSequence that wraps the original sequence and executes the specified action on close

Parameters

T

the type of elements produced by the sequence

onClose

the action to be executed when the sequence is closed