tenprint
07/26/2019, 2:03 PMMyJavaClass {
MyKotlinClass myKotlinClass;
void myMethod() { ... }
... myKotlinClass.foo(this::myMethod);
}
What should be the parameter in fun foo( ? )
?diesieben07
07/26/2019, 2:08 PMvoid
as a return type, you need to use something like Runnable
or Consumer
from java.util.function
or make your own functional interface.Evan R.
07/26/2019, 2:40 PM() -> Unit
or () -> Nothing
diesieben07
07/26/2019, 2:41 PM() -> Unit
requires you to do return kotlin.Unit.getINSTANCE()
(or something) from Javastreetsofboston
07/26/2019, 3:17 PM() -> Nothing
. This type is a function/lambda that never returns normally (either it loops forever or it always throws an exception).tenprint
07/26/2019, 3:28 PM() -> Unit
I had to do weird stuff in my Java function like return Unit.INSTANCE