A library to make sure code blocks are executed only once
Configuring the dependencies:
dependencies {
implementation("io.johnsonlee:once:1.1.0")
}
Then, you can use it in your code:
class Gretting {
val once = Once<Unit>()
fun hello(name: String): Unit = once {
println("Hello, ${name}")
}
}