william
06/13/2019, 9:25 PMonComplete: () -> Unit = {}
would it be best to put this no-op function in a companion object somewhere or does kotlin automatically do any optimizations ?karelpeeters
06/13/2019, 10:20 PMfun foo(block: () -> Unit) {
block()
}
fun main() {
foo {}
foo {}
}
shows that there's not much optimization happening here, two separate classes are created to represent the {}
. You can try looking at your exact case too.william
06/13/2019, 11:16 PMkarelpeeters
06/13/2019, 11:25 PM