Is it possible to set a default value for a higher...
# announcements
j
Is it possible to set a default value for a higher order function?
Copy code
inline fun blah(
	flush: Boolean = false,
	action: String = "Unknown",
	account: Any? = null,
	entities: MutableList<Any> = mutableListOf<Any>(),
	f1: (em: EntityManager) -> MutableList<Any>? = { em -> mutableListOf<Any>() },
	f2: (em: EntityManager) -> Unit = { em -> Unit }
): Result {

   
	return Result( ...  )
}
The f1 and f2 part doesn't compile What I'm trying to accomplish here is to be able to do:
Copy code
blah { em ->
    // return nothing here
}
or
Copy code
blah { em -> 
    mutableListOf("1", "2", "3")
}
So if you return nothing, f1 is executed, if you return a list, f2 is executed