https://kotlinlang.org logo
Title
e

elect

05/13/2019, 1:54 PM
is there a way to have a unique method for both Java and Kotlin that plays nice with lambda?
inline fun method(lambda: () -> Unit) // Java needs at the end `return Unit.INSTANCE;`
void method(Runnable lambda) // Kotlin needs to wrap it into `Runnable { }` and you dont have inline
how?
d

david-wg2

05/13/2019, 2:09 PM
void myMethod(Runnable runnable) {
}
r

ribesg

05/13/2019, 2:12 PM
You should be able to have both java files and kotlin files in any kotlin project. Obviously not in the same file
e

elect

05/13/2019, 2:12 PM
I'd lose the
inline
s

Stephan Schroeder

05/13/2019, 3:00 PM
not on the Kotlin side. Do you try to trick Java into inlining?
t

tseisel

05/13/2019, 3:03 PM
I'd remove Java 😆