I have a function that needs to call another function to do work. I want to delay the second function call until needed. The reason is that sometimes the second function call is not needed.
The code looks like this:
suspend fun doWork(list: List<A>) {
if(list.isEmpty()) return
secondFunction()
}
However, secondFunction() has to be determined by the caller of the function. Is there a way to do this maybe by using lambda?