https://kotlinlang.org logo
Title
b

brianwernick

04/28/2017, 2:46 PM
In the meantime you can swap out the interface with a lambda reference (i.e.
public void callingMethod(TestInterface interface)
to
fun callingMethod(lambda: (string) -> String)
👍 1
r

Ruckus

04/28/2017, 2:48 PM
Or to keep the naming convention:
fun callingMethod(apply: (String) -> String)
👍 1
n

north

04/28/2017, 2:54 PM
doesn't really work in many cases
for example you need to pass a list of implementations as a parameter
there are restrictions you have based on the code design you choose
b

brianwernick

04/28/2017, 2:57 PM
If you need some cases that need the
TestInterface
you can keep the original interface method and create a new one that takes a lambda (for those use cases) which then does the conversion to the Interface method (so you only have 1 path)
n

north

04/28/2017, 3:01 PM
yup.... saw it in the thread you linked ... and also posted below, with a slight mistake
thanks for the help
b

brianwernick

04/28/2017, 3:02 PM
You’re welcome 🙂