If I have a Kotlin function
fun f(cb: (Int) -> Unit)
and I want to call f
from Java, I have to do it like:
f(i -> {
dosomething();
return Unit.INSTANCE;
});
which looks very ugly. Why can't I just write it like f(i -> dosomething());
, since Unit
in Kotlin is equivalent to void
in Java?
Aucun commentaire:
Enregistrer un commentaire