cloudstream/app/src/main/java/com/lagradost/cloudstream3/utils/IDisposable.kt
2021-07-28 21:14:45 +02:00

12 lines
No EOL
259 B
Kotlin

package com.lagradost.cloudstream3.utils
interface IDisposable {
fun dispose()
}
object IDisposableHelper {
fun <T : IDisposable> using(disposeObject: T, work: (T) -> Unit) {
work.invoke(disposeObject)
disposeObject.dispose()
}
}