janvladimirmostert
09/11/2017, 12:24 PMinline 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:
blah { em ->
// return nothing here
}
or
blah { em ->
mutableListOf("1", "2", "3")
}
So if you return nothing, f1 is executed, if you return a list, f2 is executed